/** * sp_Installer::displayInstallationCompletePage() - this method displays the * installation complete page * * @return void */ public function displayInstallationCompletePage() { global $administrator_email; $db = new Querier(); $db->exec("UPDATE staff SET staff.email=" . $db->quote($administrator_email) . " WHERE staff.staff_id = 1"); ?> <div id="maincontent" style="max-width: 800px; margin-right: auto; margin-left: auto;"> <div class="install-pluslet" name="error_page" align="center"> <h2 class="bw_head"><?php echo _("Installation Complete"); ?> </h2> <p><?php echo _("SubjectsPlus installation complete. Please log in."); ?> </p> <p><?php echo _("<strong>Username: </strong> ") . "{$administrator_email}"; ?> </p> <p><?php echo _("<strong>Password: </strong> "); echo htmlentities($this->lstrRandomPassword); ?> </p> <p><a href="login.php" target="_blank"><?php echo _("Log In"); ?> </a></p> </div> </div> <?php }
public function processSection() { global $IconPath; $lobjGuide = new Guide(); if (isset($this->_input['action'])) { switch ($this->_input['action']) { case 'create': // print section and slider div $new_id = rand(1, 100000); print "<div id=\"section_{$new_id}\" class=\"sp_section pure-g\" data-layout='4-4-4'>"; print "<div class=\"sp_section_controls\">"; print "<i class=\"fa fa-arrows section_sort\" title=\"Move Section\"></i>\n\t\t\t\t\t<i class=\"fa fa-trash-o section_remove\" title=\"Delete Section\"></i>\n\t\t\t\t\t</div>"; print $lobjGuide->dropBoxes(0, 'left', ""); print $lobjGuide->dropBoxes(1, 'center', ""); print $lobjGuide->dropBoxes(2, 'sidebar', ""); print '<div id="clearblock" style="clear:both;"></div> <!-- this just seems to allow the space to grow to fit dropbox areas -->'; print '</div>'; break; case 'delete': if (isset($_POST['section_id'])) { $db = new Querier(); $q = "DELETE p, s\n\t\t\t\t\t\t\tFROM pluslet p\n\t\t\t\t\t\t\tINNER JOIN pluslet_section ps\n\t\t\t\t\t\t\tON p.pluslet_id = ps.pluslet_id\n\t\t\t\t\t\t\tINNER JOIN section s\n\t\t\t\t\t\t\tON ps.section_id = s.section_id\n\t\t\t\t\t\t\tWHERE p.type != 'Special'\n\t\t\t\t\t\t\tAND s.section_id = " . $_POST['section_id']; if ($db->exec($q) === FALSE) { print "Query Error! Did not delete"; } else { print "Thy will be done!"; } } else { print "Error: No section ID"; } break; default: print 'No action.'; break; } } else { print 'No action.'; } }
function modifySD() { $de_duped = array_unique($this->_department_id); foreach ($de_duped as $value) { if (is_numeric($value)) { $db = new Querier(); $qUpSD = "INSERT INTO staff_department (staff_id, department_id) VALUES (\n " . scrubData($this->_staff_id, 'integer') . ",\n " . scrubData($value, 'integer') . ")"; $db = new Querier(); $rUpSD = $db->exec($qUpSD); $this->_debug .= "<p>3. (insert staff_department loop) : {$qUpSD}</p>"; } } }
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 import_libguides($subject_values) { $db = new Querier(); $subject_id = $subject_values[0][1]->__toString(); if ($this->guide_imported()[0][0] != 0) { exit; } foreach ($subject_values as $subject) { // Remove the apostrophes and spaces from the shortform $shortform = preg_replace('/\\s+/', '_', str_replace("'", "", $subject[0])); // Escape the apostrophes in the guide name $guide_name = str_replace("'", "''", $subject[0]); $guide_check = $this->guide_dupe($guide_name); if ($guide_check[0][0] != 0) { $dupe_message = "It looks like this guide has already been imported."; return $dupe_message; } if ($subject[0] != null) { if ($db->exec("INSERT INTO subject (subject, subject_id, shortform, description, keywords) VALUES ('{$guide_name}', '{$subject['1']}', '{$shortform}' , '{$subject['3']}', '{$subject['7']}')")) { echo $subject[1]; } else { echo $subject[1][0]; $query = "INSERT INTO subject (subject, subject_id, shortform, last_modified, description, keywords) VALUES ('{$guide_name}', '{$subject['1']}', '{$shortform}' , '{$subject['2']}', '{$subject['3']}', '{$subject['7']}')"; //error_log( "Error inserting subject:"); //error_log ($query); //error_log ( $db->errorInfo() ); } if ($this->getGuideOwner() != null) { $staff_id = $this->getStaffID($this->getGuideOwner()); //error_log ("Staff ID: " . $staff_id ); if ($db->exec("INSERT INTO staff_subject (subject_id, staff_id) VALUES ({$subject['1']}, {$staff_id})")) { //error_log ("Inserted staff: '$staff_id'"); } else { //error_log("Error inserting staff. "); } } } else { } $subject_page = $subject[4]; $tab_index = 0; foreach ($subject_page->PAGE as $tab) { // LibGuide's pages are tabs so make a new tab $tab_index++; $clean_tab_name = $db->quote($tab->NAME); if ($db->exec("INSERT INTO tab (tab_id, subject_id, label, tab_index) VALUES ('{$tab->PAGE_ID}', '{$subject['1']}', {$clean_tab_name}, {$tab_index} - 1)")) { //error_log ("Inserted tab '$tab->NAME'"); } else { //error_log( "Problem inserting the tab, '$tab->NAME'. This tab may already exist in the database." ); //error_log ("Error inserting tab:"); //error_log ($db->errorInfo()); } $row = 0; $column = 0; $section_index = null; foreach ($tab->BOXES as $section) { // LibGuide's box parents into sections $section_uniqid = $section_index . rand(); $section_index++; if ($db->exec("INSERT INTO section (tab_id, section_id, section_index) VALUES ('{$tab->PAGE_ID}', {$section_uniqid} , {$section_index})")) { //error_log("Inserted section"); } else { //error_log("Problem inserting this section. This section may already exist in the database."); //error_log("Error inserting section:"); //error_log($db->errorInfo() ); } } foreach ($tab->BOXES->BOX as $pluslet) { // This imports each LibGuide's boxes as pluslets $description = null; // Import images and replace the old urls with new urls $doc = new \DOMDocument(); $doc->loadHTML(mb_convert_encoding($pluslet->DESCRIPTION, 'UTF-8')); $nodes = $doc->getElementsByTagName("img"); foreach ($nodes as $node) { foreach ($node->attributes as $attr) { $test = strpos($attr->value, "http://"); if ($test !== false) { //error_log( $attr->value); $attr->value = $this->download_images($attr->value); } } $description .= "<div class=\"description\">" . htmlspecialchars($doc->saveHTML()) . "</div>"; } foreach ($pluslet->LINKS->LINK as $link) { $db = new Querier(); $record = $db->query("SELECT * FROM location WHERE location = " . $db->quote($link->URL), NULL, TRUE); $record_title = $db->query("SELECT title.title,title.title_id, location.location FROM \nlocation_title \nJOIN title ON title.title_id = location_title.title_id\nJOIN location on location.location_id = location_title.location_id\nWHERE location.location_id = " . $record[0]['location_id']); if ($record_title[0]["title"] == "") { $description .= "<div class=\"links\">" . "<span class=\"link_title\"> {$link->NAME} </span>" . "<div class=\"link-description\">{$link->DESCRIPTION_SHORT}</div>" . "</div>"; } if ($record_title[0][title]) { $description .= "<div class=\"links\">" . "{{dab},{" . $record[0]['location_id'] . "}," . "{" . $record_title[0]["title"] . "},{01}}" . "<div class=\"link-description\">{$link->DESCRIPTION_SHORT}</div>" . "</div>"; } //error_log ("REEECCCCCORRDDD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); //error_log($record_title); //error_log("SELECT * FROM location WHERE location = " . $db->quote($link->URL)); } foreach ($pluslet->BOOKS->BOOK as $book) { $description .= "<div class=\"books\">" . "<a href=\"{$book->URL}\">{$book->TITLE}</a>" . "<div class=\"book-description\">{$link->DESCRIPTION}</div>" . "</div>"; } $description .= "<div class=\"media\">" . $pluslet->DESCRIPTION . "</div>"; $clean_description = $db->quote($description); if ($db->exec("INSERT INTO pluslet (pluslet_id, title, body, type) VALUES ({$pluslet->BOX_ID}, '{$pluslet->NAME}', {$clean_description}, 'Basic')")) { //error_log("Inserted pluslet '$pluslet->NAME'"); $clean_description = null; } else { //error_log("Error inserting pluslet:"); //error_log($db->errorInfo()); } if ($db->exec("INSERT INTO pluslet_section (pluslet_id, section_id, pcolumn, prow) VALUES ('{$pluslet->BOX_ID}', '{$section_uniqid}', {$column}, {$row})")) { //error_log("Inserted pluslet section relationship"); // This sticks the newly created pluslet into a section } else { //error_log("Error inserting pluslet_section:"); //error_log( $db->errorInfo()); } } } } }
/** * sp_Updater::update() - this method updates to SubjectPlus 3.0 * * @return boolean */ public function update() { $db = new Querier(); $lstrVersion = $this->getCurrentVersion(); switch ($lstrVersion) { case '1': foreach ($this->lobj1NewTables as $lstrNQuery) { if ($db->query($lstrNQuery) === FALSE) { $this->displayUpdaterErrorPage(_("Problem creating new table.") . "<br />{$lstrNQuery}"); return FALSE; } } foreach ($this->lobj1InsertInto as $lstrIQuery) { if ($db->query($lstrIQuery) === FALSE) { $this->displayUpdaterErrorPage(_("Problem inserting new data into table.") . "<br />{$lstrIQuery}"); return FALSE; } } if (!$this->fix1ExistingData()) { return FALSE; } if (!$this->before1AlterQueries()) { return FALSE; } foreach ($this->lobj1AlterTables as $lstrAQuery) { if ($db->exec($lstrAQuery) === FALSE) { //if rss doesn't exist, keep going. assume correct column $lobjDBErrorInfo = $db->errorInfo(); if ($lobjDBErrorInfo[2] == 'Can\'t DROP \'rss\'; check that column/key exists') { continue; } $this->displayUpdaterErrorPage(_("Problem altering existing tables.") . "<br />{$lstrAQuery}"); return FALSE; } } if (!$this->after1AlterQueries()) { return FALSE; } case '2': foreach ($this->lobj2NewTables as $lstrNQuery) { if ($db->query($lstrNQuery) === FALSE) { $this->displayUpdaterErrorPage(_("Problem creating new table.") . "<br />{$lstrNQuery}"); return FALSE; } } foreach ($this->lobj2InsertInto as $lstrIQuery) { if ($db->query($lstrIQuery) === FALSE) { $this->displayUpdaterErrorPage(_("Problem inserting new data into table.") . "<br />{$lstrIQuery}"); return FALSE; } } if (!$this->fix2ExistingData()) { return FALSE; } foreach ($this->lobj2AlterTables as $lstrAQuery) { if ($db->exec($lstrAQuery) === FALSE) { //if duplicate column, keep going. assume correct column $lobjDBErrorInfo = $db->errorInfo(); if ($lobjDBErrorInfo[1] == '1060') { continue; } $this->displayUpdaterErrorPage(_("Problem altering existing tables.") . "<br />{$lstrAQuery}"); return FALSE; } } default: break; } if (!$this->updateRewriteBases()) { return FALSE; } return TRUE; }
public function updateRecord() { ///////////////////// // update talkback table ///////////////////// $db = new Querier(); $qUpTB = "UPDATE talkback SET question = " . $db->quote(scrubData($this->_question, 'text')) . ",\n\t q_from = " . $db->quote(scrubData($this->_q_from, 'text')) . ",\n\t answer = " . $db->quote(scrubData($this->_answer, 'richtext')) . ","; if ($this->_a_from == '') { $qUpTB .= "a_from = NULL,"; } else { $qUpTB .= "a_from = " . $db->quote(scrubData($this->_a_from, 'text')) . ","; } $qUpTB .= "display = " . $db->quote(scrubData($this->_display, 'integer')) . ",\n \n tbtags = " . $db->quote(scrubData($this->_tbtags, 'text')) . ",\n cattags = " . $db->quote(scrubData($this->_cattags, 'text')) . "\n \n WHERE talkback_id = " . scrubData($this->_talkback_id, 'integer'); //print $qUpTB; $rUpTB = $db->exec($qUpTB); // ///////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// $updateChangeTable = changeMe("talkback", "update", $this->_talkback_id, $this->_question, $_SESSION['staff_id']); // message $this->_message = _("Thy Will Be Done. Updated."); }
public function updateRecord() { $db = new Querier(); ///////////////////// // update video table ///////////////////// // print "UPDATE RECORD!!!"; $qUpVid = "UPDATE video SET title = " . $db->quote($this->_title) . ", description = " . $db->quote(scrubData($this->_description, 'text')) . "," . "source = " . $db->quote($this->_source) . "," . "foreign_id = " . $db->quote($this->_foreign_id) . "," . "duration = " . $db->quote($this->_duration) . "," . "date = " . $db->quote($this->_date) . "," . "display = " . $db->quote($this->_display) . "," . "vtags = " . $db->quote($this->_vtags) . "WHERE video_id = " . $db->quote($this->_video_id); //print $qUpVid; $rUpVid = $db->exec($qUpVid); // ///////////////////// // Alter chchchanges table // table, flag, item_id, title, staff_id //////////////////// $updateChangeTable = changeMe("video", "update", $this->_video_id, $this->_title, $_SESSION['staff_id']); // message $this->_message = _("Thy Will Be Done. Updated."); }
public function updateBio($new_bio) { $db = new Querier(); $q = "UPDATE staff SET bio = " . $db->quote(scrubData($new_bio, "richtext")) . " WHERE staff_id = " . $this->_staff_id; $this->_debug = "<p class=\"debug\">Bio Update query: {$q}</p>"; $r = $db->exec($q); // now our detailed version $q2 = "UPDATE staff SET bio = " . $db->quote(scrubData($new_bio, "richtext")) . " WHERE staff_id = " . $this->_staff_id; $this->_debug .= "<p class=\"debug\">Bio Update query: {$q2}</p>"; $r2 = $db->query($q2); if ($r) { $updateChangeTable = changeMe("staff", "update", $this->_staff_id, "bio update", $_SESSION['staff_id']); return TRUE; } }
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}"); } }