Ejemplo n.º 1
0
 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}");
     }
 }
Ejemplo n.º 2
0
    //depending on step, display content
    switch ($lintStep) {
        case 0:
            //first setup config with site configurations
            $lobjConfig->displaySetupSiteConfigForm();
            break;
        case 1:
            //on POST and second step, write configuration and install
            if (isset($_POST['submit_setup_site_config'])) {
                $lobjConfig->setNewConfigValues();
                if (!$lobjConfig->writeConfigFile()) {
                    //error message
                    $lobjConfig->displayMessage(_("Something went wrong and could not save configurations."));
                } else {
                    //include again if config variables have changed
                    include_once 'includes/config.php';
                    //new installer instance and install and on success show complete page
                    $lobjInstaller = new Installer();
                    if ($lobjInstaller->install()) {
                        $administrator_email = $_POST['administrator_email'];
                        $db = new Querier();
                        $db->exec("UPDATE staff SET staff.email=" . $db->quote($administrator_email) . " WHERE staff.staff_id = 1");
                        $lobjInstaller->displayInstallationCompletePage();
                        $_SESSION['firstInstall'] = 1;
                    }
                }
            }
            break;
    }
}
include_once "includes/footer.php";
Ejemplo n.º 3
0
 // check if we already have a record like this
 $our_id = scrubData($_REQUEST["foreign_id"]);
 $qcheck = "SELECT video_id FROM video WHERE foreign_id = '" . $our_id . "'";
 //print $qcheck;
 $rcheck = $db->query($qcheck);
 if (count($rcheck) == 0) {
     $qinsert = "INSERT INTO video (title, description, source, foreign_id, duration, date, display)\n        values(\"" . $_POST["title"] . "\", \"" . $_POST["description"] . "\", \"" . $_POST["source"] . "\", \"" . $_POST["foreign_id"] . "\", \"" . $_POST["duration"] . "\", \"" . $_POST["upload_date"] . "\",\n          1                \n        )";
     //   print_r ($qinsert);
     $rinsert = $db->exec($qinsert);
     $video_id = $db->last_id();
 } else {
     // Do an update
     $db = new Querier();
     $qupdate = "UPDATE video \n          SET title = " . $db->quote(scrubData($_POST['title'])) . ",\n          description = " . $db->quote(scrubData($_POST['description'], 'richtext')) . ",\n          source = " . $db->quote(scrubData($_POST['source'])) . " ,\n          foreign_id = " . $db->quote(scrubData($_POST['foreign_id'])) . ",\n          duration = " . $db->quote(scrubData($_POST['duration'])) . " ,\n          date = " . $db->quote(scrubData($_POST['upload_date'])) . " ,\n          WHERE foreign_id = " . $our_id;
     //print_r ($qupdate);
     $rupdate = $db->exec($qupdate);
     $video_id = $rupdate[0];
 }
 // insert/update image
 // get small thumbnail
 $image = curl_get($_POST["thumbnail_small"]);
 //$image = file_get_contents($_POST["thumbnail_small"]);
 $new_image = "../../assets/images/video_thumbs/" . $video_id . "_small.jpg";
 file_put_contents($new_image, $image);
 // get medium thumbnail (actually the youtube one is pretty large)
 $image = curl_get($_POST["thumbnail_medium"]);
 //$image = file_get_contents($_POST["thumbnail_medium"]);
 $new_image = "../../assets/images/video_thumbs/" . $video_id . "_medium.jpg";
 file_put_contents($new_image, $image);
 print "<p><strong>" . _("Modified.") . "</strong>  <a href=\"video.php?video_id={$video_id}\">" . _("Check metadata for accuracy.  New videos are now active.") . "</a>.</p>";
 break;
Ejemplo n.º 4
0
 public function save()
 {
     $db = new Querier();
     $lobjTabs = json_decode($this->_input['tabs'], true);
     // Remove all existing entries for that guide from intervening table
     $subject_id = $this->_input["this_subject_id"];
     $qs = "SELECT tab_id FROM tab WHERE subject_id = '{$subject_id}'";
     $drs = $db->query($qs);
     // list all pluslets associated with guide before save that aren't special
     $qp = "SELECT p.pluslet_id\nFROM pluslet p\nINNER JOIN pluslet_section ps\nON p.pluslet_id = ps.pluslet_id\nINNER JOIN section sec\nON ps.section_id = sec.section_id\nINNER JOIN tab t\nON sec.tab_id = t.tab_id\nINNER JOIN subject s\nON t.subject_id = s.subject_id\nWHERE s.subject_id = {$subject_id}\nAND p.type != 'Special'";
     $lobjBeforePluslets = $db->query($qp);
     $lobjAfterPluslets = array();
     // initiate list currently saving pluslets
     foreach ($drs as $row) {
         $qd = "DELETE ps, sec FROM pluslet_section ps\n\tINNER JOIN section sec\n\tON ps.section_id = sec.section_id\n\tWHERE sec.tab_id = '{$row[0]}'";
         $db->exec($qd);
         $qd = "DELETE FROM tab WHERE tab_id = '{$row[0]}'";
         $db->exec($qd);
     }
     $lintTabIndex = 0;
     foreach ($lobjTabs as $lobjTab) {
         if (isset($lobjTab['external'])) {
         } else {
             $lobjTab['external'] = NULL;
         }
         $qi = "INSERT INTO tab (subject_id, label, tab_index, external_url, visibility) VALUES ('{$subject_id}', '{$lobjTab['name']}', {$lintTabIndex}, '{$lobjTab['external']}', {$lobjTab['visibility']})";
         // print $qi . "<br />";
         $db->exec($qi);
         $lintTabId = $db->last_id();
         $lintSectionIndex = 0;
         // insert sections
         foreach ($lobjTab['sections'] as $lobjSection) {
             // insert section, as of now only one per tab
             $qi = "INSERT INTO section (section_index, layout, tab_id) VALUES ('{$lintSectionIndex}', '{$lobjSection['layout']}', '{$lintTabId}')";
             // print $qi . "<br />";
             $db->exec($qi);
             $lintSecId = $db->last_id();
             $left_col = $lobjSection["left_data"];
             $center_col = $lobjSection["center_data"];
             $sidebar = $lobjSection["sidebar_data"];
             // added by dgonzalez in order to separate by '&pluslet[]=' even if dropspot-left doesn't exist
             $left_col = "&" . $left_col;
             $center_col = "&" . $center_col;
             $sidebar = "&" . $sidebar;
             // remove the "drop here" non-content & get all our "real" contents into array
             $left_col = str_replace("dropspot-left[]=1", "", $left_col);
             $leftconts = explode("&pluslet[]=", $left_col);
             $center_col = str_replace("dropspot-center[]=1", "", $center_col);
             $centerconts = explode("&pluslet[]=", $center_col);
             $sidebar = str_replace("dropspot-sidebar[]=1", "", $sidebar);
             $sidebarconts = explode("&pluslet[]=", $sidebar);
             // CHECK IF THERE IS CONTENT
             // Now insert the appropriate entries
             foreach ($leftconts as $key => $value) {
                 if ($key != 0) {
                     $qi = "INSERT INTO pluslet_section (pluslet_id, section_id, pcolumn, prow) VALUES ('{$value}', '{$lintSecId}', 0, '{$key}')";
                     // print $qi . "<br />";
                     $db->exec($qi);
                     array_push($lobjAfterPluslets, $value);
                 }
             }
             foreach ($centerconts as $key => $value) {
                 if ($key != 0) {
                     $qi = "INSERT INTO pluslet_section (pluslet_id, section_id, pcolumn, prow) VALUES ('{$value}', '{$lintSecId}', 1, '{$key}')";
                     // print $qi . "<br />";
                     $db->exec($qi);
                     array_push($lobjAfterPluslets, $value);
                 }
             }
             foreach ($sidebarconts as $key => $value) {
                 if ($key != 0) {
                     $qi = "INSERT INTO pluslet_section (pluslet_id, section_id, pcolumn, prow) VALUES ('{$value}', '{$lintSecId}', 2, '{$key}')";
                     // print $qi . "<br />";
                     $db->exec($qi);
                     array_push($lobjAfterPluslets, $value);
                 }
             }
             $lintSectionIndex++;
         }
         $lintTabIndex++;
     }
     // delete all pluslets that are not being used anymore to avoid orphans
     foreach ($lobjBeforePluslets as $lobjPluslet) {
         if (!in_array($lobjPluslet['pluslet_id'], $lobjAfterPluslets)) {
             $q = "DELETE FROM pluslet WHERE pluslet_id = {$lobjPluslet['pluslet_id']}";
             if ($db->exec($q) === FALSE) {
                 print "Error could not remove pluslet orphans!";
                 exit;
             }
         }
     }
     // ///////////////////
     // Alter chchchanges table
     // table, flag, item_id, title, staff_id
     // //////////////////
     // $updateChangeTable = changeMe("guide", "update", $_COOKIE["our_guide_id"], $_COOKIE["our_guide"], $_SESSION['staff_id']);
     print _("Thy Will Be Done:  Guide Updated.");
 }
Ejemplo n.º 5
0
 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}");
         }
     }
 }
Ejemplo n.º 6
0
use SubjectsPlus\Control\Querier;
$subsubcat = "";
$subcat = "admin";
$page_title = "Admin Departments";
$feedback = "";
//print_r($_POST);
include "../includes/header.php";
include "../includes/autoloader.php";
// Connect to database
$db = new Querier();
if (isset($_POST["add_department"])) {
    ////////////////
    // Insert title table
    ////////////////
    $qInsertDept = "INSERT INTO department (name, telephone, department_sort, email, url) VALUES (\n\t\t" . $db->quote(scrubData($_POST["department"])) . ", \n\t\t" . $db->quote(scrubData($_POST["telephone"])) . ", \n\t\t0,\n        " . $db->quote(scrubData($_POST["email"])) . ", \n        " . $db->quote(scrubData($_POST["url"])) . "\n\t\t)";
    $rInsertDept = $db->exec($qInsertDept);
    if ($rInsertDept) {
        $feedback = _("Thy Will Be Done.  Department list updated.");
    } else {
        $feedback = _("Thwarted!  Something has gone wrong with insert.  Contact the admin.");
    }
}
if (isset($_POST["update_departments"])) {
    //////////////////////////////////
    // Get the new dept data + sort order
    //////////////////////////////////
    // wipe out existing departments
    //////////////////////
    // Create new array of results
    /////////////////////
    $a = $_POST["dept_id"];
Ejemplo n.º 7
0
function changeMe($table, $flag, $item_id, $record_title, $staff_id)
{
    $db = new Querier();
    global $dbName_SPlus;
    $record_title = TruncByWord($record_title, 15);
    // Can be insert, update, delete; only the first creates a new record, so...
    if ($flag == "insert" || $flag == "delete") {
        $q = "insert into chchchanges (staff_id, ourtable, record_id, record_title, message)\n        values(" . $staff_id . ", \"{$table}\", " . $item_id . ", \"" . $record_title . "\", \"{$flag}\")";
        $r = $db->exec($q);
        if ($r) {
            return true;
        } else {
            return false;
        }
    } else {
        // find out person who made last change to this record
        $qtest = "SELECT staff_id, chchchanges_id, message\n        FROM `chchchanges`\n        WHERE record_id = \"{$item_id}\" and ourtable = \"{$table}\" ORDER BY date_added DESC";
        $result = $db->query($qtest);
        // If there are no results, we need to insert a record
        if (!$result) {
            $q = "insert into chchchanges (staff_id, ourtable, record_id, record_title, message)\n            values(" . $staff_id . ", \"{$table}\", " . $item_id . ", \"" . $record_title . "\", \"{$flag}\")";
            $r = $db->exec($q);
            if ($r) {
                return true;
            } else {
                return false;
            }
        } else {
            // If the editor is the same as last time & it's not the first record,
            // just update the time; Otherwise, add a new entry to the table
            if ($result[0] == $staff_id && $result[2] != "insert") {
                // Editor is same as last guide updater, just update the time
                $q = "UPDATE chchchanges SET message = 'update', date_added = NOW() WHERE chchchanges_id = " . $result[1];
            } else {
                //Editor is different, add entry to table
                $q = "insert into chchchanges (staff_id, ourtable, record_id, record_title, message)\n                    values(" . $staff_id . ", \"{$table}\", " . $item_id . ", \"" . $record_title . "\", \"update\")";
            }
            //print $q;
            $r = $db->exec($q);
            if ($r) {
                return true;
            } else {
                return false;
            }
        }
    }
}
$subsubcat = "";
$subcat = "admin";
$page_title = "Admin Guide Collections";
$feedback = "";
//var_dump($_POST);
include "../includes/header.php";
include "../includes/autoloader.php";
// Connect to database
$db = new Querier();
if (isset($_POST["add_collection"])) {
    ////////////////
    // Insert title table
    ////////////////
    $qInsertGuideCollection = "INSERT INTO collection (title, description, shortform) VALUES (\n\t\t" . $db->quote(scrubData($_POST["title"])) . ", \n\t\t" . $db->quote(scrubData($_POST["description"])) . ", \n        " . $db->quote(scrubData($_POST["shortform"])) . "\n\t\t)";
    //print $qInsertGuideCollection;
    $rInsertGuideCollection = $db->exec($qInsertGuideCollection);
    if ($rInsertGuideCollection) {
        $feedback = _("Thy Will Be Done.  Guide Collection list updated.");
    } else {
        $feedback = _("Thwarted!  Something has gone wrong with insert.  Contact the admin.");
    }
}
if (isset($_POST["update_collections"])) {
    // get our vars and tidy them
    $our_collection_id = scrubData($_POST["update_collections"]);
    // remove all assocations for this collection + this suject
    $qEmpty = "DELETE FROM collection_subject WHERE collection_id = '{$our_collection_id}'";
    //print $qEmpty;
    $rEmpty = $db->exec($qEmpty);
    // insert the new subs and sort order
    foreach ($_POST["subject_id"] as $key => $value) {
Ejemplo n.º 9
0
            print '<div id="clearblock" style="clear:both;"></div> <!-- this just seems to allow the space to grow to fit dropbox areas -->';
            print '</div>';
            ?>
			<script type="text/javascript">
				makeSectionSlider('div[id="<?php 
            echo "slider_section_new_{$new_id}";
            ?>
"]');
			</script>
			<?php 
            break;
        case 'delete':
            if (isset($_POST['section_id'])) {
                $db = new Querier();
                $q = "DELETE p, s\n\t\t\t\t\t\tFROM pluslet p\n\t\t\t\t\t\tINNER JOIN pluslet_section ps\n\t\t\t\t\t\tON p.pluslet_id = ps.pluslet_id\n\t\t\t\t\t\tINNER JOIN section s\n\t\t\t\t\t\tON ps.section_id = s.section_id\n\t\t\t\t\t\tWHERE p.type != 'Special'\n\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.';
}
Ejemplo n.º 10
0
function modifyDB($id, $type)
{
    $db = new Querier();
    /*  print "<pre>";
        print_r($_POST);
        print "</pre>"; */
    // Uses the data from the POST vars to update
    $pluslet_title = isset($_POST["pluslet_title"]) ? $_POST["pluslet_title"] : '';
    $pluslet_body = isset($_POST["pluslet_body"]) ? $_POST["pluslet_body"] : '';
    $pluslet_type = isset($_POST["item_type"]) ? $_POST["item_type"] : '';
    $pluslet_extra = isset($_POST["special"]) ? $_POST["special"] : '';
    $pluslet_hide_titlebar = $_POST["boxsetting_hide_titlebar"];
    $pluslet_collapse_body = $_POST["boxsetting_collapse_titlebar"];
    $pluslet_favorite_box = $_POST["favorite_box"];
    $pluslet_target_blank_links = $_POST['boxsetting_target_blank_links'];
    if (isset($_POST["boxsetting_titlebar_styling"])) {
        $pluslet_titlebar_styling = $_POST["boxsetting_titlebar_styling"];
    } else {
        $pluslet_titlebar_styling = null;
    }
    // If clone isn't set, set to 0
    if (isset($_POST["clone"])) {
        $pluslet_clone = $_POST["clone"];
    } else {
        $pluslet_clone = 0;
    }
    // let's not have those errant slashes
    if (get_magic_quotes_gpc()) {
        $pluslet_title = stripcslashes(stripcslashes($pluslet_title));
        $pluslet_body = stripslashes(stripslashes($pluslet_body));
        $pluslet_extra = stripslashes(stripslashes($pluslet_extra));
    } else {
        $pluslet_title = stripcslashes($pluslet_title);
        $pluslet_body = stripslashes($pluslet_body);
        $pluslet_extra = stripslashes($pluslet_extra);
    }
    switch ($type) {
        case "insert":
            $q = sprintf("INSERT INTO pluslet (title, body, type, clone, extra, hide_titlebar, collapse_body, titlebar_styling, favorite_box, target_blank_links) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", $db->quote($pluslet_title), $db->quote($pluslet_body), $db->quote($pluslet_type), $db->quote($pluslet_clone), $db->quote($pluslet_extra), $db->quote($pluslet_hide_titlebar), $db->quote($pluslet_collapse_body), $db->quote($pluslet_titlebar_styling), $db->quote($pluslet_favorite_box), $db->quote($pluslet_target_blank_links));
            $db = new Querier();
            $r = $db->exec($q);
            if ($r) {
                $id = $db->last_id();
            } else {
                print "<p>There was a problem with your insert:</p>";
                print "<p>{$q}</p>";
                $id = false;
            }
            break;
        case "update":
            // update pluslet table
            //print "$pluslet_extra";
            //$q = sprintf("UPDATE pluslet set title = '%s', body = '%s', type = '%s', extra = '%s' WHERE pluslet_id = '$id'", $db->quote($pluslet_title), $db->quote($pluslet_body), $db->quote($pluslet_type), $db->quote($pluslet_clone), $pluslet_extra);
            $q = "UPDATE pluslet SET\n                title=" . $db->quote($pluslet_title) . ",\n                body=" . $db->quote($pluslet_body) . ",\n                type=" . $db->quote($pluslet_type) . ",\n                extra=" . $db->quote($pluslet_extra) . ",\n                hide_titlebar  = '{$pluslet_hide_titlebar}',\n                collapse_body = '{$pluslet_collapse_body}',\n                titlebar_styling = '{$pluslet_titlebar_styling}',\n                favorite_box = '{$pluslet_favorite_box}',\n                target_blank_links = '{$pluslet_target_blank_links}'\n                WHERE pluslet_id ='{$id}'";
            $r = $db->exec($q);
            //print $q;
            if ($r === FALSE) {
                print "<p>There was a problem with your insert:</p>";
                print "<p>{$q}</p>";
                $id = false;
            }
            break;
        case "settings":
            // update pluslet table for only settings
            $q = "UPDATE pluslet SET\n                hide_titlebar  = '{$pluslet_hide_titlebar}',\n                collapse_body = '{$pluslet_collapse_body}',\n                titlebar_styling = '{$pluslet_titlebar_styling}',\n                favorite_box = '{$pluslet_favorite_box}',\n                target_blank_links = '{$pluslet_target_blank_links}'\n                WHERE pluslet_id ='{$id}'";
            $r = $db->exec($q);
            //print $q;
            if ($r === FALSE) {
                print "<p>There was a problem with your insert:</p>";
                print "<p>{$q}</p>";
                $id = false;
            }
            break;
        case "delete":
            $q = "DELETE FROM pluslets WHERE pluslet_id = '{$id}'";
            $r = $db->query($q);
            break;
    }
    return $id;
}
Ejemplo n.º 11
0
use SubjectsPlus\Control\Querier;
$subsubcat = "";
$subcat = "admin";
$page_title = "Admin FAQ Collections";
// print_r($_POST);
include "../includes/header.php";
$db = new Querier();
//init
$ourlist = "";
$feedback = "";
if (isset($_POST["add_collection"])) {
    ////////////////
    // Insert title table
    ////////////////
    $qInsert = "INSERT INTO faqpage (name, description) VALUES (\n\t\t" . $db->quote(scrubData($_POST["new_coll_name"])) . ", ''\n\t\t)";
    $rInsert = $db->exec($qInsert);
    if ($rInsert !== FALSE) {
        $feedback = _("Thy Will Be Done.  Updated.");
    } else {
        $feedback = _("Thwarted!  Something has gone wrong with the insert.  Contact the admin.");
    }
}
if (isset($_POST["update_collections"])) {
    //////////////////////////////////
    // Get the source dept data + sort order
    //////////////////////////////////
    //////////////////////
    // Create new array of results
    /////////////////////
    $a = $_POST["faqpage_id"];
    $b = $_POST["name"];
Ejemplo n.º 12
0
//print "<pre>";
//print_r($_REQUEST);
//print_r($_POST);
$extra_q = "";
$success = FALSE;
$message = "";
$db = new Querier();
switch ($_REQUEST["action"]) {
    case "staff_mod":
        if ($_POST["selected"]) {
            // setup our extra query bit
            $extra_q = "WHERE s.subject_id IN (";
            // change the subject_id
            foreach ($_POST["selected"] as $value) {
                $q = "UPDATE staff_subject SET staff_id = " . $_POST["filter_key"] . " WHERE subject_id = {$value}";
                $r = $db->exec($q);
                $extra_q .= $value . ",";
            }
            // trim off final comma
            $extra_q = substr($extra_q, 0, -1);
            $extra_q .= ")";
            $message = _("Thy Will Be Done.");
            $success = TRUE;
        } else {
            $message = _("You must select something first.");
        }
        break;
    case "type_mod":
        // make sure the array exists
        if ($_POST["selected"]) {
            // setup our extra query bit
$lobjQuerier = new Querier();
$lobjResults = $lobjQuerier->query($lstrQuery, true);
foreach ($lobjResults as $lobjRow) {
    $lobjExtra = json_decode($lobjRow['extra']);
    if (isset($lobjExtra) || isset($lobjExtra->description)) {
        unset($lobjExtra->description);
    }
    if (!isset($lobjExtra) || !isset($lobjExtra->disciplines)) {
        if (!isset($lobjExtra)) {
            $lobjExtra = new stdClass();
        }
        $lobjExtra->disciplines = 'Science,Audiobooks';
    }
    $lstrExtra = json_encode($lobjExtra);
    $lstrQuery = "UPDATE subject SET description = 'This is a default description', extra = '{$lstrExtra}' WHERE subject_id = {$lobjRow['subject_id']}";
    $db->exec($lstrQuery);
}
$lstrQuery = "SELECT * FROM staff";
$lobjResults = $lobjQuerier->query($lstrQuery, true);
foreach ($lobjResults as $lobjRow) {
    $lobjExtra = json_decode($lobjRow['extra']);
    if (!isset($lobjExtra) || !isset($lobjExtra->disciplines)) {
        if (!isset($lobjExtra)) {
            $lobjExtra = new stdClass();
        }
        $lobjExtra->disciplines = 'Humanities,Music';
    }
    $lstrExtra = json_encode($lobjExtra);
    $lstrQuery = "UPDATE staff SET extra = '{$lstrExtra}' WHERE staff_id = {$lobjRow['staff_id']}";
    $db->exec($lstrQuery);
}