Пример #1
0
 public function output($action = "", $view = "public")
 {
     global $PublicPath;
     global $CpanelPath;
     // public vs. admin
     parent::establishView($view);
     // Get librarians associated with this guide
     $querier = new Querier();
     $qs = "SELECT f.faq_id, question, answer from faq f, faq_subject fs WHERE f.faq_id = fs.faq_id and fs.subject_id = " . $this->_subject_id . " ORDER BY question";
     //print $qs;
     $faqArray = $querier->query($qs);
     if ($faqArray) {
         $this->_body = "<ul>";
         foreach ($faqArray as $value) {
             $short_q = Truncate($value["question"], 150, '');
             $this->_body .= "<li><a target=\"_blank\" href=\"{$PublicPath}" . "faq.php?faq_id={$value['0']}\">{$short_q}</a></li>\n";
         }
         $this->_body .= "</ul>";
     } else {
         $this->_body = "<p class=\"faq-alert\">" . _("There are no FAQs linked for this guide") . "</p>";
         if ($view == "admin") {
             $this->_body = "<p class=\"faq-alert\">" . _("There are no FAQs linked for this guide") . "</p>\n                            <p><i class=\"fa fa-plus-square\"></i> <a href=\"../faq/faq.php?faq_id=&amp;wintype=pop\" class=\"showmedium-reloader\">" . _("Add New FAQ") . "</a></p>";
         }
     }
     parent::assemblePluslet();
     return $this->_pluslet;
 }
Пример #2
0
 public function getPlusletType($pluslet_id)
 {
     $db = new Querier();
     $pluslet_type = $db->query("SELECT type from pluslet WHERE pluslet_id = '{$pluslet_id}'");
     $type = $pluslet_type[0]['type'];
     return $type;
 }
Пример #3
0
 public function output($action = "", $view = "public")
 {
     // public vs. admin
     parent::establishView($view);
     // Get librarians associated with this guide
     $querier = new Querier();
     $qs = "SELECT p.pluslet_id, p.title, p.body, ps.pcolumn, p.type, p.extra\n\t\t\t\tFROM pluslet p INNER JOIN pluslet_section ps\n\t\t\t\tON p.pluslet_id = ps.pluslet_id\n\t\t\t\tINNER JOIN section sec\n\t\t\t\tON ps.section_id = sec.section_id\n\t\t\t\tINNER JOIN tab t\n\t\t\t\tON sec.tab_id = t.tab_id\n\t\t\t\tINNER JOIN subject s\n\t\t\t\tON t.subject_id = s.subject_id\n\t\t\t\tWHERE s.subject_id = '{$this->_subject_id}'\n\t\t\t\tAND p.pluslet_id != '{$this->_pluslet_id}'\n\t\t\t\tORDER BY ps.prow ASC";
     //print $qs;
     $tocArray = $querier->query($qs);
     if ($tocArray) {
         $total_rows = count($tocArray);
         $num_per_row = ceil($total_rows / 3);
         $row_count = 1;
         foreach ($tocArray as $value) {
             if ($row_count == "1" or $row_count == 1 + $num_per_row or $row_count == 1 + $num_per_row + $num_per_row) {
                 $this->_body .= "<div class=\"toc\">";
             }
             $this->_body .= "<a href=\"#box-{$value['0']}\" class=\"smaller\" id=\"boxid-{$value['0']}\">{$value['1']}</a><br />\n";
             if ($row_count == $num_per_row or $row_count == $num_per_row * 2 or $row_count == $total_rows) {
                 $this->_body .= "</div>\n";
             }
             $row_count++;
         }
         $this->_body .= "";
     } else {
         $this->_body = _("There are no contents for this guide yet!");
     }
     parent::assemblePluslet();
     return $this->_pluslet;
 }
Пример #4
0
 protected function onEditOutput()
 {
     // Get librarians associated with this guide
     $querier = new Querier();
     $qs = "SELECT *\n                FROM staff s, staff_subject ss\n                WHERE s.staff_id = ss.staff_id\n                AND ss.subject_id = " . $this->_subject_id . "\n                ORDER BY lname, fname";
     $this->_staffArray = $querier->query($qs);
     //var_dump($this->_staffArray);
     $this->_body .= $this->loadHtml(__DIR__ . '/views/GuideEditorListEditOutput.php');
 }
Пример #5
0
 public function output($action = "", $view = "public")
 {
     global $title_input_size;
     // alter size based on column
     // Get pluslets associated with this
     $querier = new Querier();
     $qs = "SELECT p.pluslet_id AS id, p.title, p.body, ps.pcolumn, p.type, p.extra,t.tab_index AS parent_id, t.label AS name\n\t\t\tFROM pluslet p INNER JOIN pluslet_section ps\n\t\t\tON p.pluslet_id = ps.pluslet_id\n\t\t\tINNER JOIN section sec\n\t\t\tON ps.section_id = sec.section_id\n\t\t\tINNER JOIN tab t\n\t\t\tON sec.tab_id = t.tab_id\n\t\t\tINNER JOIN subject s\n\t\t\tON t.subject_id = s.subject_id\n\t\t\tWHERE s.subject_id = '{$this->_subject_id}'\n\t\t\tAND p.type != 'TOC'\n\t\t\tORDER BY t.tab_index, ps.pcolumn, ps.prow ASC";
     //print $qs;
     $this->_tocArray = $querier->query($qs);
     // public vs. admin
     parent::establishView($view);
     if ($this->_extra != "") {
         $jobj = json_decode($this->_extra);
         $this->_ticked_items = explode(',', $jobj->{'ticked'});
     }
     if ($action == "edit") {
         //////////////////////
         // New or Existing?
         //////////////////////
         if ($this->_pluslet_id) {
             $this->_current_id = $this->_pluslet_id;
             $this->_pluslet_bonus_classes = "type-toc ";
             $this->_pluslet_id_field = "pluslet-" . $this->_pluslet_id;
             $this->_pluslet_name_field = "";
             $this->_title = "<input type=\"text\" class=\"\" id=\"pluslet-update-title-{$this->_current_id}\" value=\"{$this->_title}\" size=\"{$title_input_size}\" />";
             $this_instance = "pluslet-update-body-{$this->_pluslet_id}";
         } else {
             $new_id = rand(10000, 100000);
             $this->_current_id = $new_id;
             $this->_pluslet_bonus_classes = "type-toc unsortable no_overflow";
             $this->_pluslet_id_field = $new_id;
             $this->_pluslet_name_field = "new-pluslet-TOC";
             $this->_title = "<input type=\"text\" class=\"\" id=\"pluslet-new-title-{$new_id}\" name=\"new_pluslet_title\" value=\"" . "Table of Contents" . "\" size=\"{$title_input_size}\" />";
             $this_instance = "pluslet-new-body-{$new_id}";
         }
         self::generateTOC($action);
         parent::startPluslet();
         print $this->_body;
         parent::finishPluslet();
         return;
     } else {
         // Note we hide the Feed parameters in the name field
         self::generateTOC($action);
         // notitle hack
         if (!isset($this->_hide_titlebar)) {
             if (trim($this->_title) == "notitle") {
                 $this->_hide_titlebar = 1;
             } else {
                 $this->_hide_titlebar = 0;
             }
         }
         parent::assemblePluslet($this->_hide_titlebar);
         return $this->_pluslet;
     }
 }
Пример #6
0
 public function __construct($video_id = "", $flag = "")
 {
     if ($flag == "" && $video_id == "") {
         $flag = "empty";
     }
     switch ($flag) {
         case "empty":
             $this->_a_from = $_SESSION["staff_id"];
             $this->_message = _("Have you tried ingesting the data for this video?  Much faster/easier.");
             break;
         case "post":
             // prepare record for insertion or update
             // data stored in subject table
             $this->_video_id = $_POST["video_id"];
             $this->_title = $_POST["title"];
             $this->_description = $_POST["description"];
             $this->_source = $_POST["source"];
             $this->_foreign_id = $_POST["foreign_id"];
             $this->_duration = $_POST["duration"];
             $this->_date = $_POST["date"];
             $this->_display = $_POST["display"];
             $this->_vtags = $_POST["vtags"];
             break;
         case "delete":
             // kind of redundant, but just set up to delete appropriate tables?
             // $this->_staffers needed to see if they have permission to delete this record
             $this->_video_id = $video_id;
             $this->_staffers = array(0 => array($_SESSION["staff_id"], $_SESSION["fname"] . " " . $_SESSION["lname"]));
             break;
         default:
             $this->_video_id = $video_id;
             $this->_message = "";
             /////////////
             // Get tb table info
             /////////////
             $querier = new Querier();
             $q1 = "SELECT video_id, title, description, source, foreign_id, duration, date as vid_date, display, vtags\n                    FROM video WHERE video_id = " . $this->_video_id;
             $vidArray = $querier->query($q1);
             $this->_debug .= "<p>TB query: {$q1}";
             // Test if these exist, otherwise go to plan B
             if ($vidArray == FALSE) {
                 $this->_message = _("There is no active record with that ID.  Weird.");
             } else {
                 $this->_title = $vidArray[0]["title"];
                 $this->_description = $vidArray[0]["description"];
                 $this->_source = $vidArray[0]["source"];
                 $this->_foreign_id = $vidArray[0]["foreign_id"];
                 $this->_duration = $vidArray[0]["duration"];
                 $this->_date = $vidArray[0]["vid_date"];
                 $this->_display = $vidArray[0]["display"];
                 $this->_vtags = $vidArray[0]["vtags"];
             }
             break;
     }
 }
Пример #7
0
 public function __construct($pluslet_id, $flag = "", $subject_id, $isclone = 0)
 {
     parent::__construct($pluslet_id, $flag, $subject_id, $isclone);
     $this->_type = "Card";
     $this->_pluslet_bonus_classes = "type-card";
     if ($this->_extra != "") {
         $this->_extra = json_decode($this->_extra, true);
     }
     $querier = new Querier();
     if ($this->_pluslet_id != '') {
         $qry = "SELECT title FROM pluslet WHERE pluslet_id = {$this->_pluslet_id}";
         $qry_result = $querier->query($qry);
         $this->_card_title = $qry_result;
     } else {
         $this->_card_title = "";
     }
 }
Пример #8
0
 public function output($action = "", $view = "public")
 {
     global $tel_prefix;
     // public vs. admin
     parent::establishView($view);
     // Get librarians associated with this guide
     $querier = new Querier();
     $qs = "SELECT lname, fname, email, tel, title from staff s, staff_subject ss WHERE s.staff_id = ss.staff_id and ss.subject_id = " . $this->_subject_id . " ORDER BY lname, fname";
     //print $qs;
     $staffArray = $querier->query($qs);
     foreach ($staffArray as $value) {
         // get username from email
         $truncated_email = explode("@", $value[2]);
         $staff_picture = $this->_relative_asset_path . "users/_" . $truncated_email[0] . "/headshot.jpg";
         // Output Picture and Contact Info
         $this->_body .= "\n        <div class=\"subjectSpecialistPlusletOld\">\n          <div class=\"staff-image\"><img src=\"{$staff_picture}\" alt=\"Picture: {$value['1']} {$value['0']}\"  class=\"staff_photo2\" /></div>\n          <div class=\"staff-content\"><p><a href=\"mailto:{$value['2']}\">{$value['1']} {$value['0']}</a><br />{$value['4']}<br />\n             Tel: {$tel_prefix} {$value['3']}</p></div>\n        </div>\n";
     }
     parent::assemblePluslet();
     return $this->_pluslet;
 }
Пример #9
0
 public function output($action = "", $view = "public")
 {
     global $PublicPath;
     // public vs. admin
     parent::establishView($view);
     // Get librarians associated with this guide
     $querier = new Querier();
     $qs = "SELECT f.faq_id, question, answer from faq f, faq_subject fs WHERE f.faq_id = fs.faq_id and fs.subject_id = " . $this->_subject_id . " ORDER BY question";
     //print $qs;
     $faqArray = $querier->query($qs);
     if ($faqArray) {
         $this->_body = "<ul>";
         foreach ($faqArray as $value) {
             $short_q = Truncate($value[question], 150, '');
             $this->_body .= "<li><a target=\"_blank\" href=\"{$PublicPath}" . "faq.php?faq_id={$value['0']}\">{$short_q}</a></li>\n";
         }
         $this->_body .= "</ul>";
     } else {
         $this->_body = _("There are no FAQs linked for this guide");
     }
     parent::assemblePluslet();
     return $this->_pluslet;
 }
Пример #10
0
 public function outputCollectionList()
 {
     global $mod_rewrite;
     global $PublicPath;
     $db = new Querier();
     $whereclause = "";
     global $guide_path;
     $q = "SELECT collection_id, title, description, shortform FROM collection ORDER BY title";
     // $r = $db->query($q);
     //print $q;
     $row_count = 0;
     $colour1 = "oddrow";
     $colour2 = "evenrow";
     $list_collections = "<ul>";
     foreach ($db->query($q) as $myrow) {
         $row_colour = $row_count % 2 ? $colour1 : $colour2;
         $guide_location = "collection.php?d=" . $myrow[3];
         $list_collections .= "<li><a href=\"{$guide_location}\">" . htmlspecialchars_decode($myrow[1]) . "</a>\n        <div style=\"font-size: .9em;\">{$myrow['2']}</div></li>\n";
         $row_count++;
     }
     $list_collections .= "</ul>";
     return $list_collections;
 }
    $q = "ALTER TABLE `pluslet` CHANGE `extra` `extra` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
    $r = $db->query($q);
    if ($r) {
        print "<p>Made extra field larger (255 chars).</p>";
    } else {
        print "<p>Problem making extra field in pluslet table larger. Query = {$q}</p>";
    }
}
//////////////////
// 8. convert the old extra data into new json
// {"num_items":10,  "show_desc":1, "show_feed": 1, "feed_type": "Delicious"}
//////////////////
if ($convertToJson) {
    $querierExtra = new Querier();
    $qextra = "SELECT pluslet_id, type, extra\n    FROM `pluslet` \n    WHERE  type = 'deliciouslinks' OR type = 'flickr' OR type = 'rss' OR type = 'twitter'";
    $extraArray = $querierExtra->query($qextra);
    //print_r($userArray);
    foreach ($extraArray as $value) {
        $our_json = "";
        $new_type = "";
        $this_extra = explode("|", $value[2]);
        //print "$value[1] -- $value[2] -- count = " . count($this_extra) . "<p>";
        if (count($this_extra) == 3) {
            // there should be three items
            // Let's fix the types temporarily
            switch ($value[1]) {
                case "deliciouslinks":
                    $new_type = "Delicious";
                    break;
                case "flickr":
                    $new_type = "Flickr";
Пример #12
0
 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.");
 }
Пример #13
0
    /**
     * sp_LinkChecker::checkRecordsLinks() - check all records in databse links
     *
     * @return void
     */
    public function checkRecordsLinks()
    {
        global $AssetPath;
        global $CpanelPath;
        $db = new Querier();
        ?>
		<script>
		// Hide loading message/image when page is fully loaded.
		$(document).ready(function() {
			$('#loading').html('<?php 
        echo $this->getMailOptions(TRUE);
        ?>
');
		});
		</script>
		<div class="box" style="clear:both;max-width:940px;">
			<div id="loading" style="clear:both">
				<p><?php 
        print _("Please wait while the locations of all records are being checked. This will vary depending on how many locations there are.");
        ?>
</p>
				<img src="<?php 
        echo $AssetPath;
        ?>
images/loading.gif" />
			</div>
			<div id="email_content">
			<?php 
        ob_end_flush();
        $this->LinkCheckerFlush();
        $links_select = "SELECT title.title_id, title.title, title.description, location.location, location.access_restrictions " . "FROM  title " . "INNER JOIN location_title " . "ON title.title_id = location_title.title_id " . "INNER JOIN location " . "ON location_title.location_id = location.location_id";
        $links_result = $db->query($links_select);
        ?>
			<h2 style="clear:both;"><?php 
        print _("Checking All Records");
        ?>
:</h2>
			<?php 
        if (!count($links_result)) {
            ?>
				<p style="margin: 20px 0 40px 0;"><?php 
            print _("No Record Locations Exist");
            ?>
.</p>
			<?php 
        } else {
            ?>
				<table class="striper" style="width: 100%; margin: 20px 0 40px 0;">
					<thead>
						<tr>
									<th style="width: 60%"><?php 
            print _("Link");
            ?>
</th>
									<th><?php 
            print _("Status");
            ?>
</th>
									<th>&nbsp; <?php 
            print _("HTTP Error Message");
            ?>
</th>
						</tr>
					</thead>
					<tbody>
					<?php 
            $link_list = array();
            foreach ($links_result as $links_data) {
                if ($links_data['access_restrictions'] == 2) {
                    $links_data['location'] = $this->_proxy . $links_data['location'];
                }
                $url = "<a href=\"{$links_data['location']}\">{$links_data['title']}</a>";
                $this->_extra['title_id'] = $links_data['title_id'];
                $this->displayTableRowLinkStatus($url, TRUE, FALSE);
                $this->LinkCheckerFlush();
                $this->displayTableRowLinkStatus($links_data['description'], FALSE, FALSE);
            }
            ?>
					</tbody>
				</table>
			<?php 
        }
        ?>
			</div>
		</div>
		<script type="text/javascript">
		$(function (){

			$("input[name*=send_report2]").livequery('click', function(event) {

				var our_contents = $(this).attr("name");
				var our_linkresults = '<style type="text/css" media="all"></style>'
									+ '<div id="maincontent">'
									+ $("#email_content").html()
									+ '</div>';

				$("#loading").load("../guides/helpers/guide_bits.php",
				{type: 'email_link_report', sendto: our_contents, linkresults: our_linkresults, shortform: "Records"}).fadeIn(1600);
				return false;
			});


		});

		</script>
	<?php 
    }
Пример #14
0
 public function createTOC()
 {
     $toc = "<p class=\"clearboth\" font-size: 10px; text-align: center;\">Table of Contents</p>";
     $toc = "";
     $db = new Querier();
     $source_string = "select distinct source, source.source_id\n\t\tFROM title, restrictions, location, location_title, source, rank\n\t\tWHERE title.title_id = location_title.title_id and location.location_id = location_title.location_id\n\t\tAND restrictions_id = access_restrictions and rank.subject_id = '{$this->_subject_id}' and rank.title_id = title.title_id\n\t\tAND source.source_id = rank.source_id\n        ORDER BY source.source asc";
     //print $source_string;
     $source_result = $db->query($source_string);
     $total_rows = count($source_result);
     $num_per_row = ceil($total_rows / 3);
     $row_count = 1;
     foreach ($source_result as $myrow) {
         $source_id = $myrow["1"];
         $source_name = $myrow["0"];
         if ($row_count == "1" or $row_count == 1 + $num_per_row or $row_count == 1 + $num_per_row + $num_per_row) {
             $toc .= "<div style=\"float: left; width: 33%\" class=\"toc1\">";
         }
         $toc .= "<a href=\"#{$source_id}\" class=\"smaller\">{$source_name}</a><br />\n";
         if ($row_count == $num_per_row or $row_count == $num_per_row * 2 or $row_count == $total_rows) {
             $toc .= "</div>\n";
         }
         $row_count++;
     }
     $toc .= "<br class=\"clearboth\"\" />";
     //$toc .= "<br />";
     return $toc;
 }
Пример #15
0
 public function getRelatedTitles()
 {
     $db = new Querier();
     //get title ids in pluslets' resource token connected to guide
     $q = "SELECT p.body\n            FROM subject AS s\n            INNER JOIN tab AS tb ON s.subject_id = tb.subject_id\n            LEFT JOIN section AS sc ON tb.tab_id = sc.tab_id\n            LEFT JOIN pluslet_section AS ps ON sc.section_id = ps.section_id\n            LEFT JOIN pluslet AS p ON ps.pluslet_id = p.pluslet_id\n            WHERE p.body LIKE  '%{{dab}%'\n            AND s.subject_id = {$this->_subject_id}";
     $lobjResults = $db->query($q);
     $lobjMatches = array();
     $lobjTitleIds = array();
     foreach ($lobjResults as $lobjResult) {
         preg_match_all('/\\{\\{dab\\},\\{([^}]*)\\}/', $lobjResult['body'], $lobjMatches);
         $lobjTitleIds = array_merge($lobjTitleIds, $lobjMatches[1]);
     }
     return $lobjTitleIds;
 }
Пример #16
0
 function isEmailUnique($lstrType = "")
 {
     $db = new Querier();
     switch (strtolower($lstrType)) {
         case "insert":
             $lstrQuery = "SELECT email FROM staff WHERE email = " . $db->quote(scrubData($this->_email, "email"));
             break;
         case "update":
             $lstrQuery = "SELECT email FROM staff WHERE email = " . $db->quote(scrubData($this->_email, "email")) . "AND staff_id <> " . scrubData($this->_staff_id, "integer");
             break;
         default:
             return false;
     }
     $lrscSQL = $db->query($lstrQuery);
     $lintNumberOfRows = count($lrscSQL);
     if ($lintNumberOfRows > 0) {
         return false;
     }
     return true;
 }
Пример #17
0
 protected function tokenizeText()
 {
     global $proxyURL;
     global $PublicPath;
     global $FAQPath;
     global $UserPath;
     global $IconPath;
     global $open_string;
     global $close_string;
     global $open_string_kw;
     global $close_string_kw;
     global $open_string_cn;
     global $close_string_cn;
     global $open_string_bib;
     $db = new Querier();
     $icons = "";
     //$target = "target=\"_" . $target . "\"";
     $target = "";
     $target = targetBlanker();
     $tokenized = "";
     $parts = preg_split('/<span[^>]*>{{|}}<\\/span>/', $this->_body);
     if (count($parts) == 1) {
         $parts = preg_split('/{{|}}/', $this->_body);
     }
     if (count($parts) > 1) {
         // there are tokens in $body
         foreach ($parts as $part) {
             if (preg_match('/^dab},\\s?{\\d+},\\s?{.+},\\s?{[01]{3}$/', $part) || preg_match('/^dab},\\s?{\\d+},\\s?{.+},\\s?{[01]{2}$/', $part) || preg_match('/^faq},\\s?{(\\d+,)*\\d+$/', $part) || preg_match('/^cat},\\s?{.+},\\s?{.*},\\s?{\\w+$/', $part) || preg_match('/^fil},\\s?{.+},\\s?{.+$/', $part) || preg_match('/^sss},\\s?{[^}]*/', $part) || preg_match('/^toc},\\s?{[^}]*/', $part)) {
                 // $part is a properly formed token
                 $fields = preg_split('/},\\s?{/', $part);
                 $prefix = substr($part, 0, 3);
                 //print_r($fields);
                 switch ($prefix) {
                     case "faq":
                         $query = "SELECT faq_id, question FROM `faq` WHERE faq_id IN(" . $fields[1] . ") ORDER BY question";
                         $result = $db->query($query);
                         $tokenized .= "<ul>";
                         foreach ($result as $myrow) {
                             $tokenized .= "<li><a href=\"{$FAQPath}" . "?faq_id={$myrow['0']}\" {$target}>" . stripslashes(htmlspecialchars_decode($myrow[1])) . "</a></li>";
                         }
                         $tokenized .= "</ul>";
                         break;
                     case "fil":
                         $ext = explode(".", $fields[1]);
                         $i = count($ext) - 1;
                         $our_icon = showDocIcon($ext[$i]);
                         $file = "{$UserPath}/{$fields['1']}";
                         $tokenized .= "<a href=\"{$file}\" {$target}>{$fields['2']}</a> <img style=\"position:relative; top:.3em;\" src=\"{$IconPath}/{$our_icon}\" alt=\"{$ext[$i]}\" />";
                         break;
                     case "cat":
                         $pretext = "";
                         switch ($fields[3]) {
                             case "subject":
                                 $cat_url = $open_string . $fields[1] . $close_string;
                                 $pretext = $fields[2] . " ";
                                 $linktext = $fields[1];
                                 break;
                             case "keywords":
                                 $cat_url = $open_string_kw . $fields[1] . $close_string_kw;
                                 $linktext = $fields[2];
                                 break;
                             case "call_num":
                                 $cat_url = $open_string_cn . $fields[1] . $close_string_cn;
                                 $linktext = $fields[2];
                                 break;
                             case "bib":
                                 $cat_url = $open_string_bib . $fields[1];
                                 $linktext = $fields[2];
                                 break;
                         }
                         $tokenized .= "{$pretext}<a href=\"{$cat_url}\" {$target}>{$linktext}</a>";
                         break;
                     case "dab":
                         $description = "";
                         ///////////////////
                         // Check for icons or descriptions in fields[3]
                         // 00 = neither; 10 = icons no desc; 01 = desc no icons; 11 = both
                         ///////////////////
                         if (isset($fields["3"])) {
                             // Transform the number into an array of values
                             $options = str_split($fields["3"]);
                             $show_icon_option = $options[0];
                             $show_desc_option = $options[1];
                             if ($show_icon_option == 1) {
                                 $show_icons = "yes";
                                 $show_rank = 0;
                             } else {
                                 $show_icons = "";
                             }
                             if ($show_desc_option == 1) {
                                 $show_desc = 1;
                                 $show_rank = 0;
                             } else {
                                 $show_desc = "";
                             }
                             // This option was not in previous version so it needs to be checked
                             if (isset($options[2])) {
                                 $show_note_option = $options[2];
                                 if ($show_note_option == 1) {
                                     $show_note = 1;
                                 } else {
                                     $show_note = "";
                                 }
                             }
                         }
                         $query = "SELECT location, access_restrictions, format, ctags, helpguide, citation_guide, description, call_number, t.title, display_note\n                                    FROM location l, location_title lt, title t\n                                    WHERE l.location_id = lt.location_id\n                                    AND lt.title_id = t.title_id\n                                    AND t.title_id = {$fields['1']}";
                         $result = $db->query($query);
                         foreach ($result as $myrow) {
                             // eliminate final line breaks -- offset fixed 11/15/2011 agd
                             $myrow[6] = preg_replace('/(<br \\/>)+/', '', $myrow[6]);
                             // See if it's a web format
                             if ($myrow[2] == 1) {
                                 if ($myrow[1] == 1) {
                                     $url = $myrow[0];
                                     $rest_icons = "unrestricted";
                                 } else {
                                     $url = $proxyURL . $myrow[0];
                                     $rest_icons = "restricted";
                                 }
                                 $current_ctags = explode("|", $myrow[3]);
                                 // add our $rest_icons info to this array at the beginning
                                 array_unshift($current_ctags, $rest_icons);
                                 if ($show_icons == "yes") {
                                     $icons = showIcons($current_ctags);
                                 } else {
                                     $icons = "";
                                 }
                                 if ($show_desc == 1) {
                                     // if we know the subject_id, good; for public, must look up
                                     $subject_id = '';
                                     if (isset($_GET["subject_id"])) {
                                         $subject_id = $_GET["subject_id"];
                                     } elseif (isset($_GET["subject"])) {
                                         $q1 = "SELECT subject_id FROM subject WHERE shortform = '" . $_GET["subject"] . "'";
                                         $r1 = $db->query($q1);
                                         //$subject_id = $db->last_id($r1);
                                         //$subject_id = $subject_id[0];
                                         $subject_id = $r1[0]["subject_id"];
                                     }
                                     $override = findDescOverride($subject_id, $fields[1]);
                                     // if they do want to display the description:
                                     if ($override != "") {
                                         // show the subject-specific "description_override" if it exists
                                         $description = "<br />" . scrubData($override);
                                     } else {
                                         $description = "<br />" . scrubData($myrow[6]);
                                     }
                                     //$description = "<br />$myrow[9]";
                                 }
                                 if (isset($show_note) && $show_note == 1) {
                                     if ($myrow[9] != "") {
                                         $note = "<br />" . _("Note: ") . $myrow[9];
                                     }
                                 } else {
                                     $note = "";
                                 }
                                 if (!isset($note)) {
                                     $note = "";
                                 }
                                 $tokenized .= "<a href=\"{$url}\" {$target}>{$myrow['8']}</a> {$icons} {$description} {$note}";
                             } else {
                                 // It's print
                                 $format = "other";
                                 $current_ctags = explode("|", $myrow[3]);
                                 if ($show_icons == "yes") {
                                     $icons = showIcons($current_ctags);
                                 } else {
                                     $icons = "";
                                 }
                                 // added Diane Z fall 2014
                                 if ($show_desc == 1) {
                                     // if we know the subject_id, good; for public, must look up
                                     $subject_id = '';
                                     if (isset($_GET["subject_id"])) {
                                         $subject_id = $_GET["subject_id"];
                                     } elseif (isset($_GET["subject"])) {
                                         $q1 = "SELECT subject_id FROM subject WHERE shortform = '" . $_GET["subject"] . "'";
                                         $r1 = $db->query($q1);
                                         $subject_id = $r1[0]["subject_id"];
                                     }
                                     $override = findDescOverride($subject_id, $fields[1]);
                                     // if they do want to display the description:
                                     if ($override != "") {
                                         // show the subject-specific "description_override" if it exists
                                         $description = "<br />" . $override;
                                     } else {
                                         $description = "<br />" . $myrow[6];
                                     }
                                     //$description = "<br />$myrow[9]";
                                 }
                                 // end diane fall 2014
                                 if (isset($show_note) && $show_note == 1) {
                                     if ($myrow[9] != "") {
                                         $note = "<br />" . _("Note: ") . $myrow[9];
                                     }
                                 } else {
                                     $note = "";
                                 }
                                 // Simple Print (2), or Print with URL (3)
                                 if ($myrow[2] == 3) {
                                     $tokenized .= "<em>{$myrow['8']}</em><br />" . _("") . "\n                                        <a href=\"{$myrow['0']}\" {$target}>{$myrow['7']}</a>\n                                        {$icons} {$description}";
                                 } else {
                                     // check if it's a url
                                     if (preg_match('/^(https?|www)/', $myrow[0])) {
                                         $tokenized .= "<a href=\"{$myrow['0']}\" {$target}>{$myrow['8']}</a> {$icons} {$description} {$note}";
                                     } else {
                                         $tokenized .= "{$myrow['8']} <em>{$myrow['0']}</em> {$icons} {$description} {$note}";
                                     }
                                 }
                             }
                         }
                         break;
                     case 'sss':
                         global $tel_prefix;
                         $querier = new Querier();
                         $qs = "SELECT lname, fname, email, tel, title from staff WHERE email IN ('" . str_replace(',', "','", $fields[1]) . "') ORDER BY lname, fname";
                         //print $qs;
                         $staffArray = $querier->query($qs);
                         foreach ($staffArray as $value) {
                             // get username from email
                             $truncated_email = explode("@", $value[2]);
                             $staff_picture = $this->_relative_asset_path . "users/_" . $truncated_email[0] . "/headshot.jpg";
                             // Output Picture and Contact Info
                             $tokenized .= "\n                    \t\t\t<div class=\"clearboth\"><img src=\"{$staff_picture}\" alt=\"Picture: {$value['1']} {$value['0']}\"  class=\"staff_photo2\" align=\"left\" style=\"margin-bottom: 5px;\" />\n                    \t\t\t<p><a href=\"mailto:{$value['2']}\">{$value['1']} {$value['0']}</a><br />{$value['4']}<br />\n                    \t\t\tTel: {$tel_prefix} {$value['3']}</p>\n</div>\n";
                         }
                         break;
                     case 'toc':
                         $lobjTocPluslet = new Pluslet_TOC('', '', $this->_subject_id);
                         $lobjTocPluslet->setTickedItems(explode(',', $fields[1]));
                         $lobjTocPluslet->setHideTitleBar(1);
                         $tokenized .= $lobjTocPluslet->output();
                         break;
                 }
             } else {
                 $tokenized .= $part;
             }
         }
         // end foreach
     } else {
         $this->_body = $this->_body;
         return;
     }
     $this->_body = $tokenized;
 }
Пример #18
0
 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.");
 }
Пример #19
0
     //print $qcheck;
     $rcheck = $db->query($qcheck);
     if (count($rcheck) == 0) {
         echo "ok";
     } else {
         echo "dupe";
     }
     break;
 case "email_link_report":
     $message_body = stripslashes($_POST["linkresults"]);
     $subject_line = _("LinkChecker Results for ") . $_POST["shortform"];
     if ($_POST["sendto"] == "send_report2all") {
         $q = "SELECT subject, email\n                FROM subject s, staff_subject ss, staff st\n                WHERE s.subject_id = ss.subject_id\n                AND ss.staff_id = st.staff_id\n                AND s.shortform = '" . $_POST["shortform"] . "'";
         //print $q;
         $db = new Querier();
         $r = $db->query($q);
         foreach ($r as $row) {
             $mail_to .= $row[1] . ",";
         }
         $mail_to = trim($mail_to, ',');
     } else {
         $mail_to = $_SESSION["email"];
     }
     print "Sending mail to: {$mail_to}";
     //print_r($_POST);
     $messageParams = array('from' => $administrator_email, 'to' => $mail_to, 'subjectLine' => $subject_line, 'content' => $message_body);
     $message = new MailMessage($messageParams);
     $mailer = new Mailer();
     $mailer->send($message);
     break;
 case "delete_file":
Пример #20
0
 public function outputForm($wintype = "")
 {
     global $wysiwyg_desc;
     global $CKPath;
     global $CKBasePath;
     global $IconPath;
     global $guide_types;
     global $all_tbtags;
     global $all_cattags;
     //print "<pre>";print_r($this->_staffers); print "</pre>";
     $action = htmlentities($_SERVER['PHP_SELF']) . "?talkback_id=" . $this->_talkback_id;
     if ($wintype != "") {
         $action .= "&wintype=pop";
     }
     $tb_title_line = _("Edit TalkBack");
     echo "\n<form action=\"" . $action . "\" method=\"post\" id=\"new_record\" class=\"pure-form pure-form-stacked\" accept-charset=\"UTF-8\">\n<input type=\"hidden\" name=\"talkback_id\" value=\"" . $this->_talkback_id . "\" />\n<div class=\"pure-g\">\n  <div class=\"pure-u-2-3\">\n    <div class=\"pluslet\">\n      <div class=\"titlebar\">\n        <div class=\"titlebar_text\">{$tb_title_line}</div>\n        <div class=\"titlebar_options\"></div>\n      </div>\n      <div class=\"pluslet_body\">\n\n<label for=\"question\">" . _("Question") . "</label>\n<textarea name=\"question\" rows=\"4\" cols=\"50\" class=\"required_field\">" . stripslashes($this->_question) . "</textarea>\n\n<label for=\"a_from\">" . _("Question By") . "</label>\n<input type=\"text\" name=\"q_from\" size=\"20\" class=\"required_field\" value=\"" . $this->_q_from . "\">\n\n<label for=\"answer\">" . _("Answer") . "</label>";
     if ($wysiwyg_desc == 1) {
         include $CKPath;
         global $BaseURL;
         $oCKeditor = new CKEditor($CKBasePath);
         $oCKeditor->timestamp = time();
         $config['toolbar'] = 'SubsPlus_Narrow';
         // Default shows a much larger set of toolbar options
         $config['height'] = '200';
         $config['filebrowserUploadUrl'] = $BaseURL . "ckeditor/php/uploader.php";
         echo $oCKeditor->editor('answer', $this->_answer, $config);
         echo "<br />";
     } else {
         echo "<textarea name=\"answer\" rows=\"3\" cols=\"70\">" . stripslashes($this->_answer) . "</textarea>";
     }
     /////////////////////
     // Answer By
     /////////////////////
     $qStaff = "select staff_id, CONCAT(fname, ' ', lname) as fullname FROM staff WHERE ptags LIKE '%talkback%' ORDER BY lname, fname";
     $querierStaff = new Querier();
     $staffArray = $querierStaff->query($qStaff);
     // put in a default user
     if ($this->_a_from == "") {
         $selected_user = $_SESSION["staff_id"];
     } else {
         $selected_user = $this->_a_from;
     }
     $staffMe = new Dropdown("a_from", $staffArray, $selected_user, "50", "--Select--");
     $staff_string = $staffMe->display();
     $answerer = "<label=\"record_label\"></label>\n            {$staff_string}\n        ";
     /////////////////////
     // Is Live
     ////////////////////
     $is_live = "<label=\"display\"></label>\n<input name=\"display\" type=\"radio\" value=\"1\"";
     if ($this->_display == 1) {
         $is_live .= " checked=\"checked\"";
     }
     $is_live .= " /> " . _("Yes") . " &nbsp;&nbsp;&nbsp; <input name=\"display\" type=\"radio\" value=\"0\"";
     if ($this->_display == 0) {
         $is_live .= " checked=\"checked\"";
     }
     $is_live .= " /> " . _("No") . "\n<br class=\"clear-both\" /><br />";
     /////////////////////
     // tbtags
     ////////////////////
     $tb_tags = "<input type=\"hidden\" name=\"tbtags\" value=\"" . $this->_tbtags . "\" />\n\t\t\t<label=\"record_label\"></label>";
     $current_tbtags = explode("|", $this->_tbtags);
     $tag_count = 0;
     // added because if you have a lot of ctags, it just stretches the div forever
     foreach ($all_tbtags as $key => $value) {
         if ($tag_count == 3) {
             $tb_tags .= "<br />";
             $tag_count = 0;
         }
         if (in_array($key, $current_tbtags)) {
             $tb_tags .= "<span class=\"ctag-on\">{$key}</span>";
         } else {
             $tb_tags .= "<span class=\"ctag-off\">{$key}</span>";
         }
         $tag_count++;
     }
     /////////////////////
     // cattags
     ////////////////////
     $cat_tags = "<input type=\"hidden\" class=\"cattag-data\" name=\"cattags\" value=\"" . $this->_cattags . "\" />\n\t\t\t<label=\"record_label\"></label>";
     $current_cattags = explode("|", $this->_cattags);
     $tag_count = 0;
     // added because if you have a lot of ctags, it just stretches the div forever
     foreach ($all_cattags as $key => $value) {
         if ($tag_count == 3) {
             $cat_tags .= "<br />";
             $tag_count = 0;
         }
         if (in_array($value, $current_cattags)) {
             $cat_tags .= "<span class=\"ctag-on\">{$value}</span>";
         } else {
             $cat_tags .= "<span class=\"ctag-off\">{$value}</span>";
         }
         $tag_count++;
     }
     echo "\n\n</div>\n</div>\n</div>\n<!-- right hand column -->";
     $last_mod = _("Last modified: ") . lastModded("talkback", $this->_talkback_id);
     $title_save_box = "<div id=\"last_edited\">{$last_mod}</div>";
     echo "<div class=\"pure-u-1-3\">\n    <div class=\"pluslet\">\n      <div class=\"titlebar\">\n        <div class=\"titlebar_text\">{$title_save_box}</div>\n        <div class=\"titlebar_options\"></div>\n      </div>\n      <div class=\"pluslet_body\">\n    <input type=\"submit\" name=\"submit_record\" class=\"button pure-button pure-button-primary\" value=\"" . _("Save Now") . "\" />";
     // if a) it's not a new record, and  b) we're an admin or c) we are listed as a librarian for this guide, show delete button
     if ($this->_talkback_id != "") {
         if (isset($_SESSION["admin"]) && $_SESSION["admin"] == "1") {
             echo "<input type=\"submit\" name=\"delete_record\" class=\"button pure-button delete_button  pure-button-warning\" value=\"" . _("Delete Forever!") . "\" />";
         }
     }
     echo "</div></div>";
     makePluslet(_("Answered By"), $answerer, "no_overflow");
     makePluslet(_("Is this comment live?"), $is_live, "no_overflow");
     makePluslet(_("Site Tags (relevant library sites)"), $tb_tags, "no_overflow");
     makePluslet(_("Topic Tags (relevant topics)"), $cat_tags, "no_overflow");
 }
Пример #21
0
 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}");
         }
     }
 }
Пример #22
0
 function writeTable($qualifier, $subject_id = '')
 {
     global $IconPath;
     global $proxyURL;
     // sanitize submission
     $selected = scrubData($qualifier);
     $subject_id = scrubData($subject_id);
     // determine submission type
     $selected = getTableOptions($selected, $subject_id);
     if (isset($subject_id) && $subject_id != "") {
         $q = "select distinct left(title,1) as initial, title, description, location, access_restrictions, title.title_id as this_record,\neres_display, display_note, pre, citation_guide, ctags\n        FROM title, restrictions, location, location_title, source, rank\n        {$selected}\n        AND title.title_id = location_title.title_id\n        AND location.location_id = location_title.location_id\n        AND restrictions_id = access_restrictions\n       \n        AND rank.title_id = title.title_id AND source.source_id = rank.source_id\n        ORDER BY title ";
     } else {
         $q = "select distinct left(title,1) as initial, title, description, location, access_restrictions, title.title_id as this_record,\neres_display, display_note, pre, citation_guide, ctags\n\t\tFROM title, restrictions, location, location_title, source\n\t\t{$selected}\n\t\tAND title.title_id = location_title.title_id\n\t\tAND location.location_id = location_title.location_id\n\t\tAND restrictions_id = access_restrictions\n\n\t\tORDER BY title";
     }
     //print $q;
     $db = new Querier();
     $r = $db->query($q);
     // check row count for 0 returns
     $num_rows = count($r);
     if ($num_rows == 0) {
         return "<div class=\"no_results\">" . _("Sorry, there are no results at this time.") . "</div>";
     }
     // prepare 	header
     $items = "<table width=\"98%\" class=\"item_listing\">";
     $row_count = 0;
     $colour1 = "oddrow";
     $colour2 = "evenrow";
     foreach ($r as $myrow) {
         $row_colour = $row_count % 2 ? $colour1 : $colour2;
         $patterns = "/'|\"/";
         $replacements = "";
         $item_title = $myrow["title"];
         $safe_title = trim(preg_replace($patterns, $replacements, $item_title));
         $blurb = $myrow["description"];
         $bib_id = $myrow["5"];
         /// CHECK RESTRICTIONS ///
         if ($myrow['4'] == 2 or $myrow['4'] == 3) {
             $url = $proxyURL . $myrow[3];
             $rest_icons = "restricted";
         } else {
             $url = $myrow[3];
             $rest_icons = "";
             // if you want the unlocked icon to show, enter "unrestricted" here
         }
         $current_ctags = explode("|", $myrow["ctags"]);
         // add our $rest_icons info to this array at the beginning
         array_unshift($current_ctags, $rest_icons);
         $icons = showIcons($current_ctags);
         //Check if there is a display note
         if ($myrow["display_note"] == NULL) {
             $display_note_text = "";
         } else {
             $display_note_text = "<strong>" . _("Note:") . " </strong>{$myrow['display_note']}";
         }
         $bonus = "{$blurb}";
         if ($blurb != "") {
             $information = "<img src=\"{$IconPath}/information.png\" border=\"0\" alt=\"" . _("more information") . "\" title=\"" . _("more information") . "\"  id=\"bib-{$bib_id}\" />";
         } else {
             $information = "";
         }
         $items .= "\n\t<tr class=\"zebra {$row_colour}\" valign=\"top\">\n\t\t\n\t\t<td><a href=\"{$url}\" target=\"_blank\"><strong>{$item_title}</strong></a> {$icons}<br/>{$bonus}   {$display_note_text}\n                   \n\t</tr>";
         $row_count++;
     }
     $items .= "</table>";
     return $items;
 }
Пример #23
0
 /**
  * Updater::getCurrentVersion() - this methods queries the database to return
  * what version of SP is currently being used
  *
  * @return string
  */
 private function getCurrentVersion()
 {
     $db = new Querier();
     //test whether current vesion is 3.x
     $lstrQuery = 'SHOW TABLES LIKE \'section\'';
     $rscResults = $db->query($lstrQuery);
     $lintRowCount = count($rscResults);
     //no key SubjectsPlus 3..0 tables exists
     if ($lintRowCount != 0) {
         return '3';
     }
     //test whether current vesion is 2.x
     $lstrQuery = 'SHOW TABLES LIKE \'discipline\'';
     $rscResults = $db->query($lstrQuery);
     $lintRowCount = count($rscResults);
     //no key SubjectsPlus 3..0 tables exists
     if ($lintRowCount != 0) {
         return '2';
     }
     //if none, version is 1.x
     return '1';
 }
Пример #24
0
 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());
                 }
             }
         }
     }
 }
Пример #25
0
$header = "noshow";
include "../includes/header.php";
// get our limit, if there is one
// Keep it safe by only accepting certain values
switch ($_POST["limit"]) {
    case "10":
    case "50":
        $our_limit = "LIMIT 0," . $_POST["limit"];
        break;
    case "all":
        $our_limit = "";
        break;
}
$querierTBYES = new Querier();
$qTBYES = "SELECT talkback_id, question, q_from, date_submitted, DATE_FORMAT(date_submitted, '%b %D %Y') as date_formatted, answer, a_from, display, last_revised_by, tbtags\n    FROM talkback\n    WHERE tbtags LIKE '%" . $_POST["filter"] . "%'\n    ORDER BY date_submitted DESC\n    {$our_limit}";
$tbArrayYes = $querierTBYES->query($qTBYES);
$tb_yes_answer = genTalkBacks($tbArrayYes, 1);
print $tb_yes_answer;
//print_r($_POST);
switch ($_POST["filter"]) {
    case "add_collection":
        $subject_name = Truncate($_POST["our_sub_text"], 25, '');
        echo "<div class=\"selected_item_wrapper\"><div class=\"selected_item\">\n            <input type=\"hidden\" name=\"collection[]\" value=\"" . $_POST["our_sub_id"] . "\" />\n            " . $subject_name . "</div>\n        <div class=\"selected_item_options\"><i class=\"fa fa-times\" class=\"delete_sub\" alt=\"delete\"></i>\n        </div></div>";
        break;
    case "add_subject":
        $subject_name = Truncate($_POST["our_sub_text"], 25, '');
        echo "<div class=\"selected_item_wrapper\"><div class=\"selected_item\" \">\n            <input type=\"hidden\" name=\"subject[]\" value=\"" . $_POST["our_sub_id"] . "\" />\n            " . $subject_name . "</div>\n        <div class=\"selected_item_options\"><i class=\"fa fa-times\" class=\"delete_sub\" alt=\"delete\"></i>\n        </div></div>";
        break;
    case "recommend_delete":
        $del_record = $CpanelPath . "faq/faq.php?faq_id=" . $_POST["our_id"];
        $message_body = "<p>" . _("The following record is recommended for delete") . ":</p>\n            <p><a href=\"{$del_record}\">{$del_record}</a></p>";
Пример #26
0
 protected function getEditorData($staffId)
 {
     $querier = new Querier();
     $qs = "SELECT lname, fname, email, tel, title, extra, social_media\n                FROM staff\n                WHERE staff_id = {$staffId}";
     $editorData = $querier->query($qs);
     return $editorData;
 }