function getQueryHeader($type) { global $graph; $header = ""; //$header = 'DEFINE input:inference "http://escience.rpi.edu/ontology/BCO-DMO/bcodmo/3/0/rdfs"'; $header .= getPrefixes(); $header .= 'SELECT DISTINCT '; switch ($type) { case "programs": case "projects": $header .= '(fn:concat(?title_label," (",?acronym,")") as ?label) ?id (count(DISTINCT ?dataset) AS ?count)'; break; case "datasets": $header .= '?dcname ?dcid ?pid ?pname ?dcurl ?depname ?depid ?dsid ?dsurl'; break; case "platforms": $header .= '(fn:concat(?title_label," ",?base_label) as ?label) ?id (count(DISTINCT ?dataset) AS ?count)'; break; case "mapper": $header .= '?deploymentId ?datasetId ?deploymentName ?datasetName ?datasetUrl'; break; case "count": $header .= '(count(DISTINCT ?dataset) AS ?count)'; break; case "instcats": $header .= '?label ?id ?parent (count(DISTINCT ?dataset) AS ?count)'; break; case "paramcats": $header .= '?label ?id ?parent (count(DISTINCT ?dataset) AS ?count)'; break; default: $header .= '?label ?id (count(DISTINCT ?dataset) AS ?count)'; } return $header . ' WHERE { GRAPH <' . $graph . '> { '; }
function ModifyPrefixSettings() { global $context, $txt; $context['page_title'] = $txt['manageposts_prefix_settings']; $context['settings_title'] = $txt['manageposts_prefix_settings']; $context['sub_template'] = 'prefix_settings'; getPrefixes(); if (isset($_GET['save'])) { checkSession(); // check existing ones for changes... foreach ($context['prefixes'] as $prefix) { $id = $prefix['id_prefix']; if (isset($_POST['name_' . $id]) && strlen($_POST['name_' . $id]) >= 2) { /*if($_POST['name_'.$id] != $prefix['name'] || $_POST['html_before_'.$id] != $prefix['html_before'] || $_POST['html_after_'.$id] != $prefix['html_after'] || $_POST['boards_'.$id] != $prefix['boards']) { smf_db_query( ' UPDATE {db_prefix}prefixes SET name = {string:name}, html_before = {string:html_before}, html_after = {string:html_after}, boards = {string:boards} WHERE id_prefix = {int:id_prefix}', array('id_prefix' => $id, 'name' => $_POST['name_'.$id], 'html_before' => htmlentities($_POST['html_before_'.$id]), 'html_after' => htmlentities($_POST['html_after_'.$id]), 'boards' => $_POST['boards_'.$id]));*/ if ($_POST['name_' . $id] != $prefix['name'] || $_POST['boards_' . $id] != $prefix['boards'] || $_POST['groups_' . $id] != $prefix['groups']) { $boards = normalizeCommaDelimitedList($_POST['boards_' . $id]); $groups = normalizeCommaDelimitedList($_POST['groups_' . $id]); smf_db_query(' UPDATE {db_prefix}prefixes SET name = {string:name}, boards = {string:boards}, groups = {string:groups} WHERE id_prefix = {int:id_prefix}', array('id_prefix' => $id, 'name' => htmlspecialchars($_POST['name_' . $id]), 'boards' => $boards, 'groups' => $groups)); } } } // check the new fields for ($i = 0; $i < 5; $i++) { if (isset($_POST['name_new_' . $i]) && strlen($_POST['name_new_' . $i]) >= 2) { /*smf_db_query( ' INSERT INTO {db_prefix}prefixes (name, html_before, html_after, boards) VALUES({string:name}, {string:html_before}, {string:html_after}, {string:boards})', array('name' => $_POST['name_new_'.$i], 'html_before' => htmlentities($_POST['html_before_new_'.$i]), 'html_after' => htmlentities($_POST['html_after_new_'.$i]), 'boards' => $_POST['boards_new_'.$i]));*/ $boards = normalizeCommaDelimitedList($_POST['boards_new_' . $id]); $groups = normalizeCommaDelimitedList($_POST['groups_new_' . $id]); smf_db_query(' INSERT INTO {db_prefix}prefixes (name, boards, groups) VALUES({string:name}, {string:boards}, {string:groups})', array('name' => htmlentities($_POST['name_new_' . $i]), 'boards' => $boards, 'groups' => $groups)); } } redirectexit('action=admin;area=postsettings;sa=prefixes'); } }
<?php include 'vendor/autoload.php'; require 'vendor/kwijibo/raffles/lib/rafflesstore.php'; require 'helpers.php'; $Config = getConfig(); if (empty($Config->name)) { redirect('_setup'); } $Store = new \Raffles\RafflesStore(RAFFLES_DATA_DIR); $site_name = $Config->name; $title = ''; $showMap = false; $types = $Store->getTypes(); $prefixes = getPrefixes($Config, $Store); $namespaces = array_flip($prefixes); $licenses = getLicenses(); $page = 1; $pageSize = !empty($_GET['_pageSize']) ? $_GET['_pageSize'] : 10; $offset = isset($_GET['_page']) && ($page = $_GET['_page']) ? ($_GET['_page'] - 1) * $pageSize : 0; $data = array(); if ($query = getQuery()) { $data = $Store->query($query, $pageSize, $offset); } else { if (!empty($_GET['_uri'])) { $data = $Store->get($_GET['_uri']); } else { if (!empty($_GET['_related'])) { $data = $Store->get(null, null, $_GET['_related'], $pageSize, $offset); } else { if (!empty($_GET['_search'])) {