function mediaForm($form, &$form_state) { global $user; $UID = $user->uid; $params = drupal_get_query_parameters(); if (isset($params['MID'])) { $MID = $form_state['MID'] = $params['MID']; } else { if (isset($form_state['MID'])) { $MID = $form_state['MID']; } else { drupal_set_message('No media selected.', 'error'); return; } } $media = dbGetMedia($MID); if (isset($media['OID'])) { $form_state['OID'] = $media['OID']; } $form['fields'] = array('#type' => 'fieldset', '#title' => t('Assign Media')); $form['fields']['back'] = array('#prefix' => '<left>', '#limit_validation_errors' => array(), '#submit' => array('backToMedia'), '#type' => 'submit', '#value' => '⇦ Cancel Changes', '#attributes' => array('OnSubmit' => 'if(!confirm("Back?")){return false;}'), '#suffix' => '</left>'); $form['fields']['title'] = array('#prefix' => '<table id="table-fields"><tr><td>', '#type' => 'textfield', '#title' => t('Media Name'), '#suffix' => '</td>', '#default_value' => $media['title']); $form['fields']['picture'] = array('#prefix' => '<td>', '#type' => 'item', '#markup' => '<img src="' . generateURL($media['FID']) . '" style="max-width:200px; width:auto; height:auto;">', '#suffix' => '</td></tr>'); $form['fields']['description'] = array('#prefix' => '<tr><td>', '#type' => 'textarea', '#title' => t('Description'), '#suffix' => '</td></tr>', '#default_value' => $media['description']); $team = getCurrentTeam(); $teams = dbGetTeamsForUser($UID); $form_state['teams'] = $teams; $TID = $team['TID']; $form_state['oldTID'] = $TID; if (count($teams) != 1) { $choices = array(); foreach ($teams as $userTeam) { $choices[$userTeam['TID']] = $userTeam['number']; } $form['fields']['team'] = array('#prefix' => '<tr><td>', '#type' => 'select', '#title' => t('Team to be Associated With'), '#default_value' => $TID, '#options' => $choices, '#chosen' => true, '#suffix' => '</td></tr>', '#ajax' => array('callback' => 'modify', 'limit_validation_errors' => array(), 'wrapper' => 'div_OID_wrapper')); } else { $form['fields']['team'] = array('#markup' => '<tr><td></td></tr>'); } $outreachList = dbGetOutreachListForTeam(getCurrentTeam()['TID']); $form_state['outreachList'] = $outreachList; if (empty($outreachList)) { drupal_set_message("You don't have any outreaches to assign this to.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); return; } $form['fields']['OID-header'] = array('#markup' => '<tr><td>'); $form['fields']['OID'] = array('#prefix' => '<div id="div_OID_wrapper">', '#type' => 'select', '#title' => t('Outreach Event to be Associated With'), '#default_value' => $media['OID'], '#validated' => true, '#options' => $form_state["outreachList"], '#chosen' => true, '#suffix' => '</div>'); $form['fields']['OID-footer'] = array('#markup' => '</td></tr>'); $form['fields']['remove'] = array('#prefix' => '<tr><td>', '#type' => 'submit', '#value' => t('Delete Picture'), '#limit_validation_errors' => array(), '#submit' => array("removeMediaFromForm"), '#attributes' => array('onclick' => 'if(!confirm("Are you sure you want to delete this file?")){return false;}'), '#suffix' => '</td>'); $form['fields']['submit'] = array('#prefix' => '<td style="text-align:right">', '#type' => 'submit', '#value' => t('Submit'), '#suffix' => '</td></tr>'); $form['tableFooter'] = array('#markup' => '</table>'); return $form; }
/** * Get link to blog post. * @return Link to blog post. */ function getPostLink() { global $dbi, $settings; if ($settings->linkType == 1 || $settings->linkType == 3) { // Check if post with same title exists $multiplePost = false; $result = $dbi->query("SELECT subject FROM " . blogPostTableName . " WHERE subject=" . $dbi->quote($this->subject) . " AND id!=" . $dbi->quote($this->id)); if ($result->rows()) { $multiplePost = true; } $result->finish(); return generateURL(scriptUrl . "/" . folderBlog . "/" . fileBlogPost, array($this->subject, $settings->linkType == 3 || $multiplePost ? $this->id : 0)); } return scriptUrl . "/" . folderBlog . "/" . fileBlogPost . "?postId=" . $this->id; }
<h2>You are about to delete a link.</h2> <p> Do you really want to delete this link? </p> <div class="linkPreview"> <p class="linkAssoc"> <?php echo generateURL($link); ?> <br /> ↓<br /> <a href="<?php echo generateURL($link); ?> "><?php echo $data[$link]['url']; ?> </a> </p> </div> <p class="linksConfirm"> <a href="?do=delete&link=<?php echo $_GET['link']; ?> &ok">Yes, I am</a> — <a href="?do=links">No, I changed my mind!</a> </p>
saveSessionVariable("cqlQuery", $cqlQuery); // function 'saveSessionVariable()' is defined in 'include.inc.php' // Build the correct query URL: // (we skip unnecessary parameters here since function 'generateURL()' and 'show.php' will use their default values for them) $queryParametersArray = array("where" => $query, "submit" => $displayType, "viewType" => $viewType, "exportStylesheet" => $exportStylesheet); // NOTE: The 'show.php' script allows anonymous users to query the 'cite_key' field (if a valid 'userID' is included in the query URL). // However, this requires that the cite key is passed in the 'cite_key' URL parameter. Since 'opensearch.php' uses the 'where' // parameter to pass its query, anonymous querying of the 'cite_key' field currently does not work for 'opensearch.php'. But // querying of user-specific fields will work if a user is logged in. if (isset($_SESSION['loginEmail'])) { // we only include the 'userID' parameter if the user is logged in $queryParametersArray["userID"] = $loginUserID; } // for user-specific fields (such as the 'cite_key' field), 'show.php' requires the 'userID' parameter // call 'show.php' (or 'rss.php' in case of RSS XML) with the correct query URL in order to output record details in the requested format: $queryURL = generateURL("show.php", $exportFormat, $queryParametersArray, false, $showRows, $rowOffset, "", $citeOrder); // function 'generateURL()' is defined in 'include.inc.php' header("Location: {$queryURL}"); } // ------------------------------------------------------------------------------------------------------------------- // Return a diagnostic error message: function returnDiagnostic($diagCode, $diagDetails) { global $recordSchema; global $exportContentType; global $contentTypeCharset; // '$contentTypeCharset' is defined in 'ini.inc.php' global $exportStylesheet; // Set the appropriate mimetype & set the character encoding to the one given in '$contentTypeCharset': setHeaderContentType($exportContentType, $contentTypeCharset); // function 'setHeaderContentType()' is defined in 'include.inc.php'
# Check for resources of this type $affectedresources = sql_array("select ref value from resource where resource_type='{$ref}' and ref>0", 0); if (count($affectedresources) > 0 && $targettype == "") { //User needs to confirm a new resource type $confirm_delete = true; } else { //If we have a target type, move the current resources to the new resource type if ($targettype != "" && $targettype != $ref) { include "../../include/resource_functions.php"; foreach ($affectedresources as $affectedresource) { update_resource_type($affectedresource, $targettype); } } // Delete the resource type sql_query("delete from resource_type where ref='{$ref}'"); redirect(generateURL($baseurl_short . "pages/admin/admin_resource_types.php", $url_params)); } } # Fetch data $restypedata = sql_query("\n\tselect \n\t\tref,\n\t\tname,\n\t\torder_by,\n\t\tconfig_options,\n\t\tallowed_extensions,\n\t\ttab_name\n from\n\t\tresource_type\n\twhere\n ref='{$ref}'\n\torder by name"); $restypedata = $restypedata[0]; include "../../include/header.php"; ?> <div class="BasicsBox"> <p> <a href="<?php echo $backurl; ?> " onClick="return CentralSpaceLoad(this,true);">< <?php echo $lang["back"]; ?>
function srwExplainResponse($exportStylesheet) { global $contentTypeCharset; // these variables are specified in 'ini.inc.php' global $databaseBaseURL; global $officialDatabaseName; global $hostInstitutionName; global $feedbackEmail; global $logoImageURL; global $defaultLanguage; global $defaultFeedFormat; global $loc; // defined in 'locales/core.php' $srwCollectionDoc = new XMLDocument(); $srwCollectionDoc->setEncoding($contentTypeCharset); $srwCollection = srwGenerateBaseTags("explainResponse"); $srwRecordBranch = new XMLBranch("srw:record"); srwGeneratePackingSchema($srwRecordBranch, "xml", "zeerex"); $srwRecordDataBranch = new XMLBranch("srw:recordData"); $srwExplainBranch = new XMLBranch("explain"); $srwExplainBranch->setTagAttribute("xmlns", "http://explain.z3950.org/dtd/2.0/"); $srwExplainBranch->setTagAttribute("xmlns:refb", "http://refbase.net/"); // extract the protocol from the base URL: if (preg_match("#^([^:]+)://.*#", $databaseBaseURL)) { $databaseProtocol = preg_replace("#^([^:]+)://.*#", "\\1", $databaseBaseURL); } else { $databaseProtocol = ""; } // extract the host from the base URL: if (preg_match("#^[^:]+://(?:www\\.)?[^/]+.*#", $databaseBaseURL)) { $databaseHost = preg_replace("#^[^:]+://(?:www\\.)?([^/]+).*#", "\\1", $databaseBaseURL); } else { $databaseHost = $databaseBaseURL; } // extract the path on server from the base URL: if (preg_match("#^[^:]+://(?:www\\.)?[^/]+/.+#", $databaseBaseURL)) { $databasePathOnServer = preg_replace("#^[^:]+://(?:www\\.)?[^/]+/(.+)#", "\\1", $databaseBaseURL); } else { $databasePathOnServer = ""; } // get the total number of records in the database: $recordCount = getTotalNumberOfRecords(); // function 'getTotalNumberOfRecords()' is defined in 'include.inc.php' // get the default number of records per page preferred by the current user: $showRows = $_SESSION['userRecordsPerPage']; // get date/time information when the database was last modified: $lastModified = getLastModifiedDateTime(); // function 'getLastModifiedDateTime()' is defined in 'include.inc.php' // --- begin server info ------------------------------------ $srwServerInfoBranch = new XMLBranch("serverInfo"); $srwServerInfoBranch->setTagAttribute("protocol", "SRU"); $srwServerInfoBranch->setTagAttribute("version", "1.1"); if (!empty($databaseProtocol)) { $srwServerInfoBranch->setTagAttribute("transport", $databaseProtocol); } $srwServerInfoBranch->setTagContent($databaseHost, "serverInfo/host"); $srwServerInfoBranch->setTagContent("80", "serverInfo/port"); // NOTE: this should really be a variable in 'ini.inc.php' or such addNewBranch($srwServerInfoBranch, "database", array("numRecs" => $recordCount, "lastUpdate" => $lastModified), $databasePathOnServer . "sru.php"); // function 'addNewBranch()' is defined in 'webservice.inc.php' // IMPORTANT: if you want to allow remote users who are NOT logged in (userID=0) to query the refbase database // via 'sru.php' then either the 'Export' or the 'Batch export' user permission needs to be // enabled at 'user_options.php?userID=0'. This will allow export of XML records via 'sru.php' // but won't allow a user who isn't logged in to export records via the web interface. However, you // should be aware that a direct GET query like 'show.php?author=miller&submit=Export&exportFormat=MODS%20XML' // will be also allowed then! // As an alternative, you can provide explicit login information within the 'serverInfo/authentication' tag // below. But, obviously, the provided login information should be only given for an account that has the // 'Export' permission bit enabled but has otherwise limited access rights! // If the 'authentication' element is present, but empty, then it implies that authentication is required // to connect to the server, however there is no publically available login. If it contains a string, then // this is the token to give in order to authenticate. Otherwise it may contain three elements: // 1. user: The username to supply. // 2. group: The group to supply. // 3. password: The password to supply. // $srwServerInfoAuthenticationBranch = new XMLBranch("authentication"); // $srwServerInfoAuthenticationBranch->setTagContent("LOGINEMAIL", "authentication/user"); // $srwServerInfoAuthenticationBranch->setTagContent("PASSWORD", "authentication/password"); // $srwServerInfoBranch->addXMLBranch($srwServerInfoAuthenticationBranch); $srwExplainBranch->addXMLBranch($srwServerInfoBranch); // --- end server info -------------------------------------- // --- begin database info ---------------------------------- $srwDatabaseInfoBranch = new XMLBranch("databaseInfo"); addNewBranch($srwDatabaseInfoBranch, "title", array("lang" => $defaultLanguage, "primary" => "true"), $officialDatabaseName); addNewBranch($srwDatabaseInfoBranch, "description", array("lang" => $defaultLanguage, "primary" => "true"), encodeHTMLspecialchars($loc["ThisDatabaseAttempts"])); $srwDatabaseInfoBranch->setTagContent(encodeHTMLspecialchars($hostInstitutionName), "databaseInfo/author"); $srwDatabaseInfoBranch->setTagContent(encodeHTMLspecialchars($hostInstitutionName) . " (" . $feedbackEmail . ")", "databaseInfo/contact"); $srwDatabaseImplementationBranch = new XMLBranch("implementation"); $srwDatabaseImplementationBranch->setTagAttribute("version", "0.9.6"); $srwDatabaseImplementationBranch->setTagAttribute("identifier", "refbase"); $srwDatabaseImplementationBranch->setTagContent("Web Reference Database (http://refbase.sourceforge.net)", "implementation/title"); $srwDatabaseInfoBranch->addXMLBranch($srwDatabaseImplementationBranch); $srwDatabaseLinksBranch = new XMLBranch("links"); addNewBranch($srwDatabaseLinksBranch, "link", array("type" => "www"), $databaseBaseURL); addNewBranch($srwDatabaseLinksBranch, "link", array("type" => "sru"), $databaseBaseURL . "sru.php"); addNewBranch($srwDatabaseLinksBranch, "link", array("type" => "rss"), $databaseBaseURL . generateURL("show.php", $defaultFeedFormat, array("where" => 'serial RLIKE ".+"'), true, $showRows)); // function 'generateURL()' is defined in 'include.inc.php' addNewBranch($srwDatabaseLinksBranch, "link", array("type" => "icon"), $databaseBaseURL . $logoImageURL); $srwDatabaseInfoBranch->addXMLBranch($srwDatabaseLinksBranch); $srwExplainBranch->addXMLBranch($srwDatabaseInfoBranch); // --- end database info ------------------------------------ // --- begin index info ------------------------------------- $srwIndexInfoBranch = new XMLBranch("indexInfo"); addNewBranch($srwIndexInfoBranch, "set", array("identifier" => "info:srw/cql-context-set/1/cql-v1.1", "name" => "cql"), ""); addNewBranch($srwIndexInfoBranch, "set", array("identifier" => "info:srw/cql-context-set/1/dc-v1.1", "name" => "dc"), ""); addNewBranch($srwIndexInfoBranch, "set", array("identifier" => "http://zing.z3950.org/cql/bath/2.0/", "name" => "bath"), ""); addNewBranch($srwIndexInfoBranch, "set", array("identifier" => "info:srw/cql-context-set/2/rec-1.1", "name" => "rec"), ""); // TODO: The index info of the refbase explain response should also list the original refbase field names, // similar to how the COPAC SRU gateway does it (<http://tweed.lib.ed.ac.uk:8080/elf/search/copac>). // Example: // <index search="true" scan="false" sort="false"> // <title>Author</title> // <map> // <name> // author // </name> // </map> // <map> // <name set="dc"> // creator // </name> // </map> // </index> $indexArray = array(); // TODO: '$indexArray' should be an array of arrays so that it can hold multiple mappings $indexArray["dc.creator"] = array("_set" => "dc", "_index" => "creator", "_title" => "author(s) of the resource", "_refbaseIndex" => "refbase-author"); $indexArray["dc.title"] = array("_set" => "dc", "_index" => "title", "_title" => "publication title of the resource", "_refbaseIndex" => "refbase-title"); $indexArray["dc.date"] = array("_set" => "dc", "_index" => "date", "_title" => "year of publication of the resource", "_refbaseIndex" => "refbase-year"); $indexArray["dc.language"] = array("_set" => "dc", "_index" => "language", "_title" => "language of the resource", "_refbaseIndex" => "refbase-language"); $indexArray["dc.description"] = array("_set" => "dc", "_index" => "description", "_title" => "abstract or summary of the resource", "_refbaseIndex" => "refbase-abstract"); $indexArray["dc.contributor"] = array("_set" => "dc", "_index" => "contributor", "_title" => "editor(s) of the resource", "_refbaseIndex" => "refbase-editor"); // the mapping dc.contributor <-> refbase-editor might be suboptimal, but probably as best as we can do for now $indexArray["dc.subject"] = array("_set" => "dc", "_index" => "subject", "_title" => "topic of the resource", "_refbaseIndex" => "refbase-keywords"); $indexArray["dc.format"] = array("_set" => "dc", "_index" => "format", "_title" => "physical or digital manifestation of the resource", "_refbaseIndex" => "refbase-medium"); // Note: Currently, we simply expose the contents of the refbase 'type' field as 'dc.type'. // This may not be ideal since it differs from the approved terms that should be used as values for the 'dc.type' element: <http://dublincore.org/documents/dcmi-type-vocabulary/>. // However, the document "Using simple Dublin Core to describe eprints" (<http://eprints-uk.rdn.ac.uk/project/docs/simpledc-guidelines/#type>) // recommends type values that are much closer (but still not identical) to our own type values. $indexArray["dc.type"] = array("_set" => "dc", "_index" => "type", "_title" => "nature or genre of the resource", "_refbaseIndex" => "refbase-type"); $indexArray["dc.publisher"] = array("_set" => "dc", "_index" => "publisher", "_title" => "publisher", "_refbaseIndex" => "refbase-publisher"); $indexArray["dc.coverage"] = array("_set" => "dc", "_index" => "coverage", "_title" => "geographic or topographic area of research", "_refbaseIndex" => "refbase-area"); // Note: I'm note sure, if 'bath.name' (or maybe better: 'bath.personalName') can be also used to describe the author/creator ('dc.creator') of a publication // "'Name Search -- Keyword' searches for complete word in headings (or references) for people, corporate bodies, conferences, and geographic names." // $indexArray["bath.name"] = array("_set" => "bath", // "_index" => "name", // "_title" => "author", // "_refbaseIndex" => "refbase-author"); // Note: Not sure again whether 'bath.topicalSubject' can be offered as synonym for 'dc.subject' // "'Topical Subject Search -- Keyword' searches for complete word in a topical subject heading or reference." // $indexArray["bath.topicalSubject"] = array("_set" => "bath", // "_index" => "topicalSubject", // "_title" => "keywords", // "_refbaseIndex" => "refbase-keywords"); // NOTE: I'm not sure if 'isbn' is a valid name for the Bath Context Set? At least, it's not listed at <http://zing.z3950.org/srw/bath/2.0/#2>. // However, 'bath.isbn' is used e.g. by <http://z3950.loc.gov:7090/voyager?operation=explain&version=1.1> and other SRU servers. $indexArray["bath.isbn"] = array("_set" => "bath", "_index" => "isbn", "_title" => "international standard book number", "_refbaseIndex" => "refbase-isbn"); $indexArray["bath.issn"] = array("_set" => "bath", "_index" => "issn", "_title" => "international standard serial number", "_refbaseIndex" => "refbase-issn"); $indexArray["bath.corporateName"] = array("_set" => "bath", "_index" => "corporateName", "_title" => "corporate author of this publication", "_refbaseIndex" => "refbase-corporate_author"); $indexArray["bath.conferenceName"] = array("_set" => "bath", "_index" => "conferenceName", "_title" => "conference this publication was presented at", "_refbaseIndex" => "refbase-conference"); // NOTE: I'm not sure if 'notes' is a valid name for the Bath Context Set? // 'bath.notes' is mentioned at <http://www.loc.gov/z3950/lcserver.html> and <http://zing.z3950.org/srw/bath/2.0/#3>. $indexArray["bath.notes"] = array("_set" => "bath", "_index" => "notes", "_title" => "notes about the resource", "_refbaseIndex" => "refbase-notes"); $indexArray["rec.identifier"] = array("_set" => "rec", "_index" => "identifier", "_title" => "database record number", "_refbaseIndex" => "refbase-serial"); $indexArray["rec.creationDate"] = array("_set" => "rec", "_index" => "creationDate", "_title" => "date/time at which the record was created", "_refbaseIndex" => "refbase-created_date-created_time"); // 'sru.php': CQL search term should get splitted into date & time information! $indexArray["rec.creationAgentName"] = array("_set" => "rec", "_index" => "creationAgentName", "_title" => "name of the agent responsible for creation of the record", "_refbaseIndex" => "refbase-created_by"); $indexArray["rec.lastModificationDate"] = array("_set" => "rec", "_index" => "lastModificationDate", "_title" => "date/time at which the record was last modified", "_refbaseIndex" => "refbase-modified_date-modified_time"); // 'sru.php': CQL search term should get splitted into date & time information! $indexArray["rec.lastModificationAgentName"] = array("_set" => "rec", "_index" => "lastModificationAgentName", "_title" => "name of the agent responsible for last modifying the record", "_refbaseIndex" => "refbase-modified_by"); $indexArray["bib.citekey"] = array("_set" => "bib", "_index" => "citekey", "_title" => "user-specific cite key for the record", "_refbaseIndex" => "refbase-cite_key"); // Not sure how these fields can be mapped: // "publication" => "Book title or journal name", // "abbrev_journal" => "Abbreviated journal name", // "volume" => "Publication volume", // "issue" => "Publication issue", // "pages" => "Range or total number of pages", // "place" => "Place of publication", // "series_title" => "Series title", // -> could 'bath.seriesTitle' be used? compare with <http://www.loc.gov/z3950/lcserver.html> and <http://copac.ac.uk/interfaces/srw/> // "abbrev_series_title" => "Abbreviated series title", // "series_volume" => "Series volume", // "series_issue" => "Series issue", // "thesis" => "Thesis", // "doi" => "Digital object identifier", // "url" => "Uniform resource locator", foreach ($indexArray as $indexKey => $index) { $srwIndexBranch = new XMLBranch("index"); $srwIndexBranch->setTagAttribute("search", "true"); $srwIndexBranch->setTagAttribute("scan", "false"); $srwIndexBranch->setTagAttribute("sort", "false"); $srwIndexBranch->setTagAttribute("refb:index", $index["_refbaseIndex"]); addNewBranch($srwIndexBranch, "title", array("lang" => "en"), $index["_title"]); $srwIndexMapBranch = new XMLBranch("map"); addNewBranch($srwIndexMapBranch, "name", array("set" => $index["_set"]), $index["_index"]); $srwIndexBranch->addXMLBranch($srwIndexMapBranch); $srwIndexInfoBranch->addXMLBranch($srwIndexBranch); } $srwExplainBranch->addXMLBranch($srwIndexInfoBranch); // --- end index info --------------------------------------- // --- begin schema info ------------------------------------- $srwSchemaInfoBranch = new XMLBranch("schemaInfo"); // MODS: $modsSchemaBranch = new XMLBranch("schema"); $modsSchemaBranch->setTagAttribute("identifier", "http://www.loc.gov/mods/v3"); // or should 'info:srw/schema/1/mods-v3.2' be used? $modsSchemaBranch->setTagAttribute("location", "http://www.loc.gov/standards/mods/v3/mods-3-0.xsd"); $modsSchemaBranch->setTagAttribute("sort", "false"); $modsSchemaBranch->setTagAttribute("retrieve", "true"); $modsSchemaBranch->setTagAttribute("name", "mods"); addNewBranch($modsSchemaBranch, "title", array("lang" => "en"), "Metadata Object Description Schema (MODS) v3"); $srwSchemaInfoBranch->addXMLBranch($modsSchemaBranch); // Simple Dublin Core (DC): $dcSchemaBranch = new XMLBranch("schema"); $dcSchemaBranch->setTagAttribute("identifier", "http://purl.org/dc/elements/1.1/"); // or should 'info:srw/schema/1/dc-v1.1' be used? $dcSchemaBranch->setTagAttribute("location", "http://dublincore.org/schemas/xmls/simpledc20021212.xsd"); $dcSchemaBranch->setTagAttribute("sort", "false"); $dcSchemaBranch->setTagAttribute("retrieve", "true"); $dcSchemaBranch->setTagAttribute("name", "dc"); addNewBranch($dcSchemaBranch, "title", array("lang" => "en"), "Simple Dublin Core (DC) v1.1"); $srwSchemaInfoBranch->addXMLBranch($dcSchemaBranch); // Simple Dublin Core (OAI_DC): // See recommendations for use of simple Dublin Core metadata to describe eprints in eprint archives: <http://eprints-uk.rdn.ac.uk/project/docs/simpledc-guidelines/> // Example SRW+DC output from LoC: <http://z3950.loc.gov:7090/voyager?query=dc.creator+%3D+%22miller%22&version=1.1&operation=searchRetrieve&recordSchema=dc&startRecord=1&maximumRecords=10> // $oaidcSchemaBranch = new XMLBranch("schema"); // $oaidcSchemaBranch->setTagAttribute("identifier", "http://www.openarchives.org/OAI/2.0/oai_dc/"); // $oaidcSchemaBranch->setTagAttribute("location", "http://www.openarchives.org/OAI/2.0/oai_dc.xsd"); // $oaidcSchemaBranch->setTagAttribute("sort", "false"); // $oaidcSchemaBranch->setTagAttribute("retrieve", "true"); // $oaidcSchemaBranch->setTagAttribute("name", "oai_dc"); // // addNewBranch($oaidcSchemaBranch, "title", array("lang" => "en"), "Simple Dublin Core for OAI-PMH (OAI_DC)"); // // $srwSchemaInfoBranch->addXMLBranch($oaidcSchemaBranch); $srwExplainBranch->addXMLBranch($srwSchemaInfoBranch); // --- end schema info --------------------------------------- // --- begin config info ------------------------------------- $srwConfigInfoBranch = new XMLBranch("configInfo"); // default: addNewBranch($srwConfigInfoBranch, "default", array("type" => "retrieveSchema"), "mods"); addNewBranch($srwConfigInfoBranch, "default", array("type" => "numberOfRecords"), $showRows); addNewBranch($srwConfigInfoBranch, "default", array("type" => "stylesheet"), $databaseBaseURL . "srwmods2html.xsl"); addNewBranch($srwConfigInfoBranch, "default", array("type" => "contextSet"), "cql"); addNewBranch($srwConfigInfoBranch, "default", array("type" => "index"), "cql.serverChoice"); addNewBranch($srwConfigInfoBranch, "default", array("type" => "relation"), "all"); // setting: addNewBranch($srwConfigInfoBranch, "setting", array("type" => "sortSchema"), "identifier"); addNewBranch($srwConfigInfoBranch, "setting", array("type" => "recordPacking"), "xml"); // supports: addNewBranch($srwConfigInfoBranch, "supports", array("type" => "proximity"), "false"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "resultSets"), "false"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "relationModifier"), "false"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "booleanModifier"), "false"); // TODO: set to 'true' when Rob's CQL-PHP has been implemented successfully addNewBranch($srwConfigInfoBranch, "supports", array("type" => "sort"), "false"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "maskingCharacter"), "true"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "anchoring"), "true"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "emptyTerm"), "false"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "recordXPath"), "false"); addNewBranch($srwConfigInfoBranch, "supports", array("type" => "scan"), "false"); $srwExplainBranch->addXMLBranch($srwConfigInfoBranch); // --- end config info --------------------------------------- $srwRecordDataBranch->addXMLBranch($srwExplainBranch); $srwRecordBranch->addXMLBranch($srwRecordDataBranch); $srwCollection->addXMLBranch($srwRecordBranch); $srwCollectionDoc->setXML($srwCollection); $srwCollectionString = $srwCollectionDoc->getXMLString(); // Add the XML Stylesheet definition: // Note that this is just a hack (that should get fixed) since I don't know how to do it properly using the ActiveLink PHP XML Package ?:-/ if (!empty($exportStylesheet)) { $srwCollectionString = preg_replace("/(?=\\<srw:explainResponse)/i", "<?xml-stylesheet type=\"text/xsl\" href=\"" . $exportStylesheet . "\"?>\n", $srwCollectionString); } return $srwCollectionString; }
function printLinks($showLinkTypes, $row, $showQuery, $showLinks, $wrapResults, $userID, $viewType, $orderBy) { global $databaseBaseURL; // these variables are defined in 'ini.inc.php' global $filesBaseURL; global $fileVisibility; global $fileVisibilityException; global $openURLResolver; global $isbnURLFormat; global $tableRefs, $tableUserData; // defined in 'db.inc.php' global $loc; // '$loc' is made globally available in 'core.php' global $client; // Note: for proper placement of links within the Links column we don't use the 'mergeLinks()' function here (as is done for Details view), // since spacing before links is handled individually for each link type $links = ""; // make sure that our buffer variable is empty // count the number of available link elements: $linkElementCounterLoggedOut = 0; // if the 'user_permissions' session variable contains 'allow_details_view'... if (in_array("details", $showLinkTypes) and isset($_SESSION['user_permissions']) and preg_match("/allow_details_view/", $_SESSION['user_permissions'])) { $linkElementCounterLoggedOut = $linkElementCounterLoggedOut + 1; } // if the 'user_permissions' session variable contains 'allow_edit'... if (in_array("edit", $showLinkTypes) and isset($_SESSION['user_permissions']) and preg_match("/allow_edit/", $_SESSION['user_permissions'])) { $linkElementCounterLoggedOut = $linkElementCounterLoggedOut + 1; } // if either the URL or the DOI field contain something if (in_array("url", $showLinkTypes) and !empty($row["url"]) or in_array("doi", $showLinkTypes) and !empty($row["doi"])) { $linkElementCounterLoggedOut = $linkElementCounterLoggedOut + 1; } elseif (in_array("isbn", $showLinkTypes) and !empty($isbnURLFormat) and !empty($row["isbn"])) { // provide a link to an ISBN resolver $linkElementCounterLoggedOut = $linkElementCounterLoggedOut + 1; } elseif (in_array("xref", $showLinkTypes) and !empty($openURLResolver)) { $linkElementCounterLoggedOut = $linkElementCounterLoggedOut + 1; } $linkElementCounterLoggedIn = $linkElementCounterLoggedOut; // if a user is logged in and a FILE is associated with the current record if (in_array("file", $showLinkTypes) and ($fileVisibility == "everyone" or $fileVisibility == "login" and isset($_SESSION['loginEmail']) or $fileVisibility == "user-specific" and (isset($_SESSION['user_permissions']) and preg_match("/allow_download/", $_SESSION['user_permissions'])) or !empty($fileVisibilityException) and preg_match($fileVisibilityException[1], $row[$fileVisibilityException[0]]))) { if (!empty($row["file"])) { // if the 'file' field is NOT empty $linkElementCounterLoggedIn = $linkElementCounterLoggedIn + 1; } } if (preg_match("/^inc/i", $client)) { // we open links in a new browser window if refbase data are included somewhere else: $target = " target=\"_blank\""; } else { $target = ""; } if (preg_match("/^(cli|inc)/i", $client) or $wrapResults == "0") { // we use absolute links for CLI clients, for include mechanisms, or when returning only a partial document structure $baseURL = $databaseBaseURL; } else { $baseURL = ""; } if (in_array("details", $showLinkTypes) and isset($_SESSION['user_permissions']) and preg_match("/allow_details_view/", $_SESSION['user_permissions'])) { // display a link that opens the Details view for this record: // NOTE: we use a 'show.php' URL here since it is much shorter and easier to bookmark as a permanent link; however, // this means one additional redirect; the old code that directly generates a 'search.php' URL is commented out below // TODO: verify that the time lag introduced by the redirect action is generally acceptable! $queryParametersArray = array("record" => $row["serial"]); // we only add further parameters to the 'show.php' URL if their current value differs from the defaults used by 'show.php' or 'search.php': if (!empty($viewType) and !preg_match("/^Web\$/i", $viewType)) { $queryParametersArray["viewType"] = $viewType; } if ($showQuery == "1") { $queryParametersArray["showQuery"] = $showQuery; } if ($showLinks == "0") { // this is kinda superfluous since, for '$showLinks=0', the link isn't shown in the first place $queryParametersArray["showLinks"] = $showLinks; } $links .= "\n\t\t<a href=\"" . $baseURL . generateURL("show.php", "html", $queryParametersArray, true) . "\"" . $target . ">" . "<i class=\"fa fa-search\"></i></a>"; // Old code that directly generates a 'search.php' URL which points to Details view for this record: // // Construct the SQL query: // // TODO: build the complete SQL query first (using functions 'buildFROMclause()' and 'buildORDERclause()'), then rawurlencode and add to link // $showDetailsQuery = buildSELECTclause("Display", $showLinks, "", false, false); // function 'buildSELECTclause()' is defined in 'include.inc.php' // // // ... display a link that opens the Details view for this record: // if (isset($_SESSION['loginEmail'])) // if a user is logged in, show user specific fields: // $links .= "\n\t\t<a href=\"" . $baseURL . "search.php" // . "?sqlQuery=" . rawurlencode($showDetailsQuery) . "%20FROM%20" . $tableRefs . "%20LEFT%20JOIN%20" . $tableUserData . "%20ON%20serial%20%3D%20record_id%20AND%20user_id%20%3D%20" . $userID . "%20"; // else // if NO user logged in, don't display any user specific fields and hide the 'location' field: // $links .= "\n\t\t<a href=\"" . $baseURL . "search.php" // . "?sqlQuery=" . rawurlencode($showDetailsQuery) . "%20FROM%20" . $tableRefs . "%20"; // // $links .= "WHERE%20serial%20RLIKE%20%22%5E%28" . $row["serial"] // . "%29%24%22%20ORDER%20BY%20" . rawurlencode($orderBy) // . "&formType=sqlSearch" // . "&showQuery=" . $showQuery // . "&showLinks=" . $showLinks // . "&submit=Display" // . "&viewType=" . $viewType // . "\"" . $target . ">" // . "<img src=\"" . $baseURL . "img/details.gif\" alt=\"" . $loc["details"] . "\" title=\"" . $loc["LinkTitle_ShowDetails"] . "\" width=\"9\" height=\"17\" hspace=\"0\" border=\"0\"></a>"; } if (($linkElementCounterLoggedOut > 0 or isset($_SESSION['loginEmail']) and $linkElementCounterLoggedIn > 0) and (in_array("details", $showLinkTypes) and isset($_SESSION['user_permissions']) and preg_match("/allow_details_view/", $_SESSION['user_permissions']))) { $links .= " "; } if (in_array("edit", $showLinkTypes) and isset($_SESSION['user_permissions']) and preg_match("/allow_edit/", $_SESSION['user_permissions'])) { // if the 'user_permissions' session variable contains 'allow_edit'... // ... display a link that opens the edit form for this record: $links .= "\n\t\t<a href=\"" . $baseURL . "record.php" . "?serialNo=" . $row["serial"] . "&recordAction=edit" . "\"" . $target . ">" . "<i class=\"fa fa-pencil\"></i></a>"; } if (($linkElementCounterLoggedOut > 1 or isset($_SESSION['loginEmail']) and $linkElementCounterLoggedIn > 1) and (in_array("edit", $showLinkTypes) and isset($_SESSION['user_permissions']) and preg_match("/allow_edit/", $_SESSION['user_permissions']))) { if (in_array("details", $showLinkTypes) and isset($_SESSION['user_permissions']) and preg_match("/allow_details_view/", $_SESSION['user_permissions'])) { $links .= "\n\t\t"; } else { $links .= " "; } } // show a link to any corresponding file if one of the following conditions is met: // - the variable '$fileVisibility' (defined in 'ini.inc.php') is set to 'everyone' // - the variable '$fileVisibility' is set to 'login' AND the user is logged in // - the variable '$fileVisibility' is set to 'user-specific' AND the 'user_permissions' session variable contains 'allow_download' // - the array variable '$fileVisibilityException' (defined in 'ini.inc.php') contains a pattern (in array element 1) that matches the contents of the field given (in array element 0) if (in_array("file", $showLinkTypes) and ($fileVisibility == "everyone" or $fileVisibility == "login" and isset($_SESSION['loginEmail']) or $fileVisibility == "user-specific" and (isset($_SESSION['user_permissions']) and preg_match("/allow_download/", $_SESSION['user_permissions'])) or !empty($fileVisibilityException) and preg_match($fileVisibilityException[1], $row[$fileVisibilityException[0]]))) { if (!empty($row["file"])) { if (preg_match("#^(https?|ftp|file)://#i", $row["file"])) { // if the 'file' field contains a full URL (starting with "http://", "https://", "ftp://" or "file://") $URLprefix = ""; } else { // use the base URL of the standard files directory as prefix: if (preg_match('#^/#', $filesBaseURL)) { if (preg_match("/^(cli|inc)/i", $client) or $wrapResults == "0") { // we use absolute links for CLI clients, for include mechanisms, or when returning only a partial document structure $URLprefix = 'http://' . $_SERVER['HTTP_HOST'] . $filesBaseURL; } else { $URLprefix = $filesBaseURL; } } else { // relative path -> file dir is located within refbase root dir $URLprefix = $baseURL . $filesBaseURL; } } if (preg_match("/\\.pdf\$/i", $row["file"])) { // if the 'file' field contains a link to a PDF file $links .= "\n\t\t<a href=\"" . $URLprefix . $row["file"] . "\"" . $target . "><img src=\"" . $baseURL . "img/file_PDF.gif\" alt=\"" . $loc["pdf"] . "\" title=\"" . $loc["LinkTitle_DownloadPDFFile"] . "\" width=\"17\" height=\"17\" hspace=\"0\" border=\"0\"></a>"; } else { $links .= "\n\t\t<a href=\"" . $URLprefix . $row["file"] . "\"" . $target . "><img src=\"" . $baseURL . "img/file.gif\" alt=\"" . $loc["file"] . "\" title=\"" . $loc["LinkTitle_DownloadFile"] . "\" width=\"11\" height=\"15\" hspace=\"0\" border=\"0\"></a>"; } // display a generic file icon as download link } } // if a DOI number exists for this record, we'll prefer it as link, otherwise we use the URL (if available): // (note, that in List view, we'll use the same icon, no matter if the DOI or the URL is used for the link) if (in_array("doi", $showLinkTypes) and !empty($row["doi"])) { $links .= "\n\t\t<a href=\"http://dx.doi.org/" . rawurlencode($row["doi"]) . "\"" . $target . "><img src=\"" . $baseURL . "img/link.gif\" alt=\"" . $loc["doi"] . "\" title=\"" . $loc["LinkTitle_GotoWebPageViaDOI"] . "\" width=\"11\" height=\"8\" hspace=\"0\" border=\"0\"></a>"; } elseif (in_array("url", $showLinkTypes) and !empty($row["url"])) { // 'htmlentities()' is used to convert any '&' into '&' $links .= "\n\t\t<a href=\"" . encodeHTML($row["url"]) . "\"" . $target . "><img src=\"" . $baseURL . "img/link.gif\" alt=\"" . $loc["url"] . "\" title=\"" . $loc["LinkTitle_GotoWebPage"] . "\" width=\"11\" height=\"8\" hspace=\"0\" border=\"0\"></a>"; } elseif (in_array("isbn", $showLinkTypes) and !empty($isbnURLFormat) and !empty($row["isbn"])) { // this is a stupid hack that maps the names of the '$row' array keys to those used // by the '$formVars' array (which is required by function 'parsePlaceholderString()') // (eventually, the '$formVars' array should use the MySQL field names as names for its array keys) $formVars = buildFormVarsArray($row); // function 'buildFormVarsArray()' is defined in 'include.inc.php' // auto-generate an ISBN link according to the naming scheme given in '$isbnURLFormat' (in 'ini.inc.php'): $isbnURL = parsePlaceholderString($formVars, $isbnURLFormat, ""); // function 'parsePlaceholderString()' is defined in 'include.inc.php' $encodedURL = encodeHTML($isbnURL); // 'htmlentities()' is used to convert higher ASCII chars into its entities and any '&' into '&' $encodedURL = str_replace(" ", "%20", $encodedURL); // ensure that any spaces are also properly urlencoded if (!empty($isbnURL)) { $links .= "\n\t\t<a href=\"" . $encodedURL . "\"" . $target . "><i class=\"fa fa-external-link\"></i></a>"; } } elseif (in_array("xref", $showLinkTypes) and !empty($openURLResolver)) { $openURL = openURL($row); // function 'openURL()' is defined in 'openurl.inc.php' $links .= "\n\t\t<a href=\"" . $openURL . "\"" . " target=\"_blank\"><i class=\"fa fa-external-link\"></i></a>"; } // insert COinS (ContextObjects in Spans): $links .= "\n\t\t" . coins($row); // function 'coins()' is defined in 'openurl.inc.php' return $links; }
<input type=hidden name=ref value="<?php echo urlencode($ref) ?>"> <?php if (isset($error_text)) { ?><div class="PageInformal"><?php echo $error_text?></div><?php } if (isset($saved_text)) { ?><div class="PageInformal"><?php echo $saved_text?></div> <?php } if($confirm_delete) { ?> <input name="confirmdelete" id="confirmdelete" type="hidden" value=""> <div class="textcenter"> <input name="delete" type="button" value=" <?php echo $lang["action-delete"]?> " onClick="jQuery('#delete').val('yes');jQuery('#confirmdelete').val('yes');this.form.submit();" /> <input type="button" class="button" onClick="CentralSpaceLoad('<?php generateURL($baseurl_short . "/pages/admin/admin_resource_type_field_edit.php",$url_params,array("ref"=>"")); ?>',true);return false;" value=" <?php echo $lang["cancel"] ?> " > </div> <?php } else { ?> <div class="Question"><label><?php echo $lang["property-field_id"] ?></label> <div class="Fixed"><?php echo $fielddata["ref"] ?></div> <div class="clearerleft"> </div> </div> <?php foreach ($fieldcolumns as $column=>$column_detail) {
?> <lable for="settings_email">Email Address: </label><input type="text" id="settings_email" value="<?php echo getSetting("email"); ?> " /> <span>The email address which emails (electronic mail (telegrams (long distance tranmission of messages)) messages) are sent from.</span><br /> <lable for="settings_replyToEmail">Reply to Address: </label><input type="text" id="settings_replyToEmail" value="<?php echo getSetting("replyToEmail"); ?> " /> <span>The email address which replies are sent to.</span><br /> <button class="btn btn-primary" id="settings_save">Save</button><br /><br /> <span id="settings_save_load"> <script type="text/javascript"> function loadUsers() { $("#users_list tbody").load("<?php echo generateURL("api/users/list"); ?> /"); } $(document).ready(function() { $("#settings_save").click(function() { $("#settings_save_load").load("<?php echo generateURL("api/settings/save"); ?> /", {email: $("#settings_email").val(), replyToEmail: $("#settings_replyToEmail").val()}); }); }); </script> <?php require_once "footer.php"; exit;
/** * Get link to page. * @return Link to this page. */ function getPageLink() { global $dbi, $settings; if (!empty($this->fullLink)) { return parseString($this->fullLink); } $title = !empty($this->navbarTitle) ? $this->navbarTitle : $this->title; if ($settings->linkType == 1 || $settings->linkType == 3) { // Check if pages with same title exists $multiplePages = false; $result = $dbi->query("SELECT title FROM " . pageTableName . " WHERE title=" . $dbi->quote($title) . " AND id!=" . $dbi->quote($this->id)); if ($result->rows()) { $multiplePages = true; } $result->finish(); return generateURL(scriptUrl . "/" . filePage, array($title, $multiplePages || $settings->linkType == 3 ? $this->id : 0)); } return scriptUrl . "/" . filePage . "?pageId=" . $this->id; }
// be displayed above results of the last multi-record query even when the user browses to another search results page or changes the sort order. $HeaderString = returnMsg($headerMsg, "", "", "HeaderString"); // function 'returnMsg()' is defined in 'include.inc.php' if ($recordAction == "add") { // Display the newly added record: header("Location: show.php?record=" . $serialNo . "&headerMsg=" . rawurlencode($headerMsg)); } elseif ($recordAction == "delet" and !empty($oldMultiRecordQuery)) { // Generate a 'search.php' URL that points to the last multi-record query: $oldMultiRecordQueryURL = generateURL("search.php", "html", $oldMultiRecordQuery, false); // Display the previous search results: header("Location: {$oldMultiRecordQueryURL}"); } elseif ($recordAction != "delet" and !empty($oldQuery)) { // Remove any previous 'headerMsg' parameter from the saved query URL: unset($oldQuery["headerMsg"]); // Generate a 'search.php' URL that points to the formerly displayed results page: $queryURL = generateURL("search.php", "html", $oldQuery, false); // Route back to the previous results display: // (i.e., after submission of the edit mask, we now go straight back to the results list that was displayed previously, // no matter what display type it was (List view, Citation view, or Details view)) header("Location: {$queryURL}"); } else { // (4) Call 'receipt.php' which displays links to the modifyed/added record as well as to the previous search results page (if any) // (routing feedback output to a different script page will avoid any reload problems effectively!) header("Location: receipt.php?recordAction=" . $recordAction . "&serialNo=" . $serialNo . "&headerMsg=" . rawurlencode($headerMsg)); } // -------------------------------------------------------------------- // (5) CLOSE CONNECTION // (5) CLOSE the database connection: disconnectFromMySQLDatabase(); // function 'disconnectFromMySQLDatabase()' is defined in 'include.inc.php' // --------------------------------------------------------------------
?> <div class="PageInformal"><?php echo $saved_text; ?> </div> <?php } if ($confirm_delete) { ?> <input name="confirmdelete" id="confirmdelete" type="hidden" value=""> <div class="textcenter"> <input name="delete" type="button" value=" <?php echo $lang["action-delete"]; ?> " onClick="jQuery('#delete').val('yes');jQuery('#confirmdelete').val('yes');this.form.submit();" /> <input type="button" class="button" onClick="CentralSpaceLoad('<?php generateURL($baseurl_short . "/pages/admin/admin_resource_type_field_edit.php", $url_params, array("ref" => "")); ?> ',true);return false;" value=" <?php echo $lang["cancel"]; ?> " > </div> <?php } else { ?> <div class="Question"><label><?php echo $lang["property-field_id"]; ?> </label> <div class="Fixed"><?php
function viewOutreachEvent() { global $user; $UID = $user->uid; $params = drupal_get_query_parameters(); if (isset($params['OID']) && $params['OID'] > 0) { $OID = $params['OID']; $outreach = dbGetOutreach($OID); if ($outreach == false) { drupal_set_message('Invalid outreach event. Click <a href="?q=teamDashboard">here</a> to navigate back to events in Team Dashboard.', 'error'); return; } $TID = $outreach['TID']; if (!isMyTeam($TID)) { drupal_set_message('You do not have permission to access this page.', 'error'); return; } // if the outreach status is outreach and the event is over, then turn the status to write up if ($outreach['status'] == "isOutreach") { outreachToWriteUp($OID); } // determine if the user can physically sign up $canSignUp = !dbIsOutreachOver($OID) && ($outreach['status'] == 'isOutreach' || $outreach['status'] == 'doingWriteUp'); $markup = ''; $markup .= '<div style="float:left; width:38%">'; $markup .= '<table style="margin:0px 0px 10px 0px;"><tr>'; $markup .= '<td style="padding:0px 14px 10px 14px;"><div align="left"><h2 style="margin:0px 0px 7px 0px;"><b>'; // display outreach name $markup .= "{$outreach['name']}"; $markup .= '</b></h2></div></td></tr>'; $markup .= '<tr><td>'; $markup .= showOutreachStatusIcon($outreach['status']); // displays the icon for a public outreach $markup .= $outreach['isPublic'] ? '<span title="Public"><img class="eventPrivacyIcon" src="/images/icons/publicBlue.png"></span>' : '<span title="Private"><img class="eventPrivacyIcon" src="/images/icons/privateBlue.png"></span>'; // displays the icon for a cancelled outreach $markup .= $outreach['cancelled'] ? '<span title="Event Cancelled"><img class="eventCancelledIcon" src="/images/icons/cancelledRed.png"' : ''; $markup .= '</td></tr></table>'; $markup .= '<table id="photoAndEdit"><tr><td style="padding:0px;">'; // cannot edit photo if user doesn't have the correct permissions if (!isMyOutreach($OID) && !hasPermissionForTeam('editAnyOutreach', getCurrentTeam()['TID'])) { $markup .= '<div align="right">'; $markup .= '<span title="Edit Photo"><button type="button" disabled><img class="editIcon" src="/images/icons/editThumbnailWhite.png"></button></span>'; $markup .= '</div>'; } else { // edit photo if user has permissions $markup .= '<div align="right">'; $markup .= '<a href= "?q=editThumbnail'; $markup .= '&OID=' . $OID . '&FID=' . $outreach['FID'] . '">'; $markup .= '<span title="Edit Photo"><button type="button"><img class="editIcon" src="/images/icons/editThumbnailWhite.png"></button></a></span>'; $markup .= '</div>'; } $markup .= '</td></tr><tr><td style="padding:0px;">'; // default picture for outreach if (!empty($outreach['FID'])) { $FID = dbGetOutreachThumbnail($OID); $url = generateURL($FID); $markup .= '<div align="center"><img src="' . $url . '" style="max-width:150px; width:auto; height:auto; padding: 5px 0px 5px 0px">'; } else { $markup .= '<div align="center"><img src="/images/defaultPics/team.png" style="max-width:200px; width:auto; height:auto; padding: 15px 0px 15px 0px">'; } $markup .= '</div></td></tr></table></div>'; $markup .= '<div align="right">'; // if the status is write-up, then allow a user to submit a write up if ($outreach['status'] == 'doingWriteUp' && !$outreach['isWriteUpSubmitted']) { $markup .= '<a href="?q=writeupform&OID=' . $outreach['OID'] . '"><button>Write Up</button></a>'; } else { if ($outreach['isWriteUpSubmitted'] && hasPermissionForTeam('approveIdeas', $TID) && $outreach['status'] == 'doingWriteUp') { $markup .= '<a href="?q=writeupform&OID=' . $outreach['OID'] . '&approving"><button>Approve Write Up</button></a>'; } } // if the status is idea, then allow a user with permissions to approve or reject the idea if ($outreach['status'] == 'isIdea' && hasPermissionForTeam('approveIdeas', $TID)) { $markup .= '<a href="?q=approveIdea/' . $outreach['OID'] . '/' . $TID . '"><button>Approve</button></a>'; $markup .= '<a href="?q=rejectIdea/' . $outreach['OID'] . '/' . $TID . '"><button>Reject</button></a>'; } // notifications button if (!isMyOutreach($OID) && !hasPermissionForTeam('editAnyOutreach', getCurrentTeam()['TID'])) { $markup .= '<button type="button" disabled>Notifications</button>'; } else { $markup .= '<a href="?q=manageNotifications&OID=' . $outreach['OID'] . '"><button>Notifications</button></a>'; } // manage sign-ups button if (!dbIsOutreachCancelled($OID)) { if (dbIsUserSignedUp($UID, $OID)) { if (dbIsOutreachOver($OID)) { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button" disabled>Edit Sign Up</button><span id="helptext"; class="helptext tooltiptext4">You cannot edit your sign up for this event because it is already over.</span></div></a>'; } else { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button">Edit Sign Up</button><span id="helptext"; class="helptext tooltiptext4">Click here to edit your sign up for this event.</span></div></a>'; } } else { if (dbIsOutreachOver($OID) || $outreach['status'] == 'isIdea') { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button" disabled>Sign Up</button><span id="helptext"; class="helptext tooltiptext4">You cannot sign up for this event because it is already over.</span></div></a>'; } else { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button">Sign Up</button><span id="helptext"; class="helptext tooltiptext4">Click here to sign up for this event.</span></div></a>'; } } } else { $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button" disabled>Sign Up</button><span id="helptext"; class="helptext tooltiptext4">You cannot sign up for this event because it is cancelled.</span></div></a>'; } // hours button if (!dbIsOutreachCancelled($OID)) { $markup .= '<a href= "?q=viewHours'; $markup .= '&OID=' . $OID . '">'; $markup .= '<button type="button" '; $markup .= $outreach['status'] == 'isIdea' ? ' disabled' : ''; $markup .= '>Hours</button></a>'; } else { // if outreach is cancelled $markup .= '<button type="button" disabled'; $markup .= $outreach['status'] == 'isIdea' ? ' disabled' : ''; $markup .= '>Hours</button>'; } // view media button $markup .= '<a href="?q=viewMedia'; $markup .= '&OID=' . $OID . '">'; $markup .= '<button type="button"'; $markup .= $outreach['status'] == 'isIdea' ? ' disabled' : ''; $markup .= '>Media</button></a>'; // edit outreach button if (!isMyOutreach($OID) && !hasPermissionForTeam('editAnyOutreach', getCurrentTeam()['TID'])) { $markup .= '<button type="button" disabled><img class="editIcon" src="/images/icons/editWhite.png"></button>'; } else { $markup .= '<a href= "?q=outreachForm'; $markup .= '&OID=' . $OID . '">'; $markup .= '<button type="button"><img class="editIcon" src="/images/icons/editWhite.png"></button></a>'; } $markup .= '</div>'; $markup .= '<div style="width:60%; float:right; padding-left:10px">'; $hasPointOfContact = false; if (!(empty($outreach['co_organization']) && empty($outreach['co_firstName']) && empty($outreach['co_email']) && empty($outreach['co_phoneNumber']))) { $hasPointOfContact = true; } // account for cases where no info is present if ($outreach['description'] == null) { $outreach['description'] = '[none]'; } if ($outreach['type'] == null || $outreach['type'] == '') { $outreach['type'] = '[none]'; } if ($outreach['status'] == null) { $outreach['status'] = '[none]'; } if ($outreach['co_organization'] == null) { $outreach['co_organization'] = '[none]'; } if ($outreach['co_position'] == null) { $outreach['co_position'] = '[none]'; } if ($outreach['co_firstName'] == null) { $outreach['co_firstName'] = '[none]'; } if ($outreach['co_email'] == null) { $outreach['co_email'] = '[none]'; } if ($outreach['co_phoneNumber'] == null) { $outreach['co_phoneNumber'] = '[none]'; } if ($outreach['city'] == null) { $outreach['city'] = '[none]'; } if ($outreach['state'] == null) { $outreach['state'] = '[none]'; } if ($outreach['address'] == null) { $outreach['address'] = '[none]'; } if ($outreach['country'] == null) { $outreach['country'] = '[none]'; } if ($outreach['totalAttendance'] == null) { $outreach['totalAttendance'] = 0; } if ($outreach['testimonial'] == null) { $outreach['testimonial'] = '[none]'; } $team = dbGetTeam($outreach['TID']); // begin displaying info body $markup .= '<table id="miniViewTeam" style="margin:16px 0px 0px 0px"><tr><td><h3><b><u>General<u></b></h3></td></tr>'; $owner = dbGetOutreachOwner($OID); $markup .= "<tr><td colspan='3'><b>Owner: </b>" . dbGetUserName($owner) . "</a></td>"; $markup .= "<td colspan='3'><b>Team: </b>{$team['number']}</td></tr>"; $markup .= '<tr><td colspan="3"><b>Tags: </b>'; $tags = dbGetTagsForOutreach($OID); if (!empty($tags)) { dpm($tags); $first = true; $length = count($tags); $i = 1; foreach ($tags as $OTID => $tagName) { $markup .= '<a href="?q=outreach&tag=' . $OTID . '">' . $tagName . '</a>'; if ($i < $length) { $markup .= ', '; } $i++; } // if there aren't any tags } else { $markup .= '[none]'; } $markup .= '</td></tr>'; $times = dbGetTimesForOutreach($OID); // display time if the outreach status isn't an idea if ($outreach['status'] != 'isIdea') { if (!empty($times)) { foreach ($times as $time) { $startTime = date(TIME_FORMAT, dbDateSQL2PHP($time['startTime'])); $endTime = date(TIME_FORMAT, dbDateSQL2PHP($time['endTime'])); $markup .= '<tr><td colspan="3"><b>Start Date: </b>' . $startTime . '</td>'; $markup .= '<td colspan="3"><b>End Date: </b>' . $endTime . '</td></tr>'; } } } $markup .= '<tr><td colspan="5" style="word-break:break-word"><b>Description: </b>'; $markup .= wordwrap($outreach['description'], 70, "<br />\n"); $markup .= '</td></tr>'; // if the outreach has contact information if ($hasPointOfContact) { $markup .= '<tr><td><h3><b><u>Contact Info<u></b></h3></td></tr>'; $markup .= '<tr><td colspan="3"><b>Host Organization: </b>'; $markup .= strip_tags($outreach['co_organization'], ALLOWED_TAGS) . '</td>'; $markup .= '<td colspan="3"><b>Contact Name: </b>'; $markup .= strip_tags($outreach['co_firstName'] . ' ' . $outreach['co_lastName'], ALLOWED_TAGS) . '</td></tr>'; $markup .= '<tr><td colspan="3"><b>Contact Email: </b>' . strip_tags($outreach['co_email'], ALLOWED_TAGS) . '</td>'; $phoneNumber = dbFormatPhoneNumber($outreach['co_phoneNumber']); $markup .= '<td colspan="3"><b>Contact Number: </b>' . $phoneNumber . '</td></tr>'; $markup .= '<tr><td colspan="6"><b>Address: </b>' . strip_tags($outreach['address'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['city'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['state'], ALLOWED_TAGS) . '</td></tr>'; $markup .= '</tr>'; } else { $markup .= '<tr><td><h3><b><u>Contact Info<u></b></h3></td></tr>'; $markup .= '<tr><td colspan="6"><b>Address: </b>' . strip_tags($outreach['address'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['city'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['state'], ALLOWED_TAGS) . '</td></tr>'; $markup .= '</tr>'; } $markup .= '<tr><td><h3><b><u>Statistics<u></b></h3></td></tr>'; $markup .= '<tr>'; if ($outreach['status'] != 'isIdea') { $numPpl = dbGetNumPplSignedUpForEvent($OID); $markup .= '<td colspan="3"><b>'; // only show the link if people are signed up if ($numPpl != 0) { $markup .= '<a href="?q=outreachList&OID=' . $OID . '"target="_blank">'; } $markup .= 'People Signed Up: </b>'; // end the link if ($numPpl != 0) { $markup .= '</a>'; } $markup .= $numPpl . '</td>'; // view total hours for the outreach $markup .= '<td colspan="3"><b>Total Hours: </b><a href="?q=viewHours&OID=' . $OID . '">' . dbGetHoursForOutreach($OID) . '</a></td></tr>'; //if the outreach status is idea } else { $markup .= '<td colspan="3">'; $markup .= '<b>People Signed Up: </b>'; $markup .= 'None'; $markup .= '</td></tr>'; } $markup .= '</table></div>'; // if the outreach has an approved write-up if ($outreach['isWriteUpApproved'] && $outreach['status'] == 'locked') { $writeUp = empty($outreach["writeUp"]) ? '[None]' : $outreach["writeUp"]; $totalAttendance = empty($outreach["totalAttendance"]) ? '[Not Filled Out]' : $outreach["totalAttendance"]; $testimonial = empty($outreach["testimonial"]) ? '[None]' : $outreach["testimonial"]; $markup .= '<div style="float:left; width:38%;"><table id="miniViewTeam" style="margin:16px 0px 0px 0px"><tr><td><h3><b><u>Write Up<u></b></h3></td>'; $markup .= '<td><a href="?q=writeupform&OID=' . $outreach['OID'] . '&approved"><button> View</button></a></td></tr>'; $markup .= '<tr><td><b>Write Up:</b></td></tr>'; $markup .= '<tr><td>' . $writeUp . '</td></tr>'; $markup .= '<tr><td><b>Total Attendance:</b></td></tr>'; $markup .= '<tr><td>' . $totalAttendance . '</td></tr>'; $markup .= '<tr><td><b>Testimonials/Comments:</b></td></tr>'; $markup .= '<tr><td>' . $testimonial . '</td></tr>'; $markup .= '</table></div>'; } $retArray = array(); $retArray['#markup'] = $markup; return $retArray; } else { drupal_set_message('Invalid outreach event. Click <a href="?q=teamDashboard">here</a> to navigate back to events in Team Dashboard.', 'error'); } }
$error = "Invalid login credentials."; } else { databaseQuery("UPDATE users SET time=%d WHERE email=%s", $_MGM['time'], $email); setcookie("{$_MGM['CookiePrefix']}user_email", $email, $_MGM['time'] + 31536000, $_MGM['CookiePath'], $_MGM['CookieDomain']); setcookie("{$_MGM['CookiePrefix']}user_password", hash("sha512", $epassword . $_MGM['time']), $_MGM['time'] + 31536000, $_MGM['CookiePath'], $_MGM['CookieDomain']); header("location: " . generateURL("members")); exit; } } } require_once "header.php"; if (!empty($error)) { ?> <div style="color: #ff0000; font-weight: bold;"><?php echo $error; ?> </div><?php } ?> <form action="<?php echo generateURL("login"); ?> " method="POST"> <input type="hidden" name="login" value="true" /> <input type="email" placeholder="Email" name="email" /><br /> <input type="password" placeholder="Password" name="password" /><br /> <input type="submit" value="Login" class="btn" /> </form> <?php require_once "footer.php"; exit;
function citeRecords($result, $rowsFound, $query, $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $previousOffset, $nextOffset, $wrapResults, $citeStyle, $citeOrder, $citeType, $orderBy, $headerMsg, $userID, $viewType) { global $databaseBaseURL; // these variables are defined in 'ini.inc.php' global $useVisualEffects; global $defaultDropDownFieldsEveryone; global $defaultDropDownFieldsLogin; global $defaultCiteStyle; global $additionalFieldsCitationView; global $displayResultsHeaderDefault; global $displayResultsFooterDefault; global $showLinkTypesInCitationView; global $showFieldItemLinks; global $maximumBrowseLinks; global $loc; // '$loc' is made globally available in 'core.php' global $client; global $displayType; $htmlData = ""; // make sure that our buffer variables are empty $recordData = ""; // First, initialize some variables that we'll need later on // Calculate the number of all visible columns (which is needed as colspan value inside some TD tags) if ($showLinks == "1" && preg_match("/^(type|type-year|year)\$/i", $citeOrder)) { // in citation layout, we simply set it to a fixed value (either '1' or '2', depending on the values of '$showLinks' and '$citeOrder') $NoColumns = 2; } else { $NoColumns = 1; } if (empty($displayType)) { $displayType = $_SESSION['userDefaultView']; } // get the default view for the current user // If the results footer is displayed, we increase the colspan value by 1 to account for the checkbox column: if (!preg_match("/^(Print|Mobile)\$/i", $viewType) and !preg_match("/^cli/i", $client) and $wrapResults != "0" and (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden")) { $NoColumns++; } // Initialize array variables: $yearsArray = array(); $typeTitlesArray = array(); // Define inline text markup to be used by the 'citeRecord()' function: $markupPatternsArray = array("bold-prefix" => "<b>", "bold-suffix" => "</b>", "italic-prefix" => "<i>", "italic-suffix" => "</i>", "underline-prefix" => "<u>", "underline-suffix" => "</u>", "endash" => "–", "emdash" => "—", "ampersand" => "&", "double-quote" => '"', "double-quote-left" => "“", "double-quote-right" => "”", "single-quote" => "'", "single-quote-left" => "‘", "single-quote-right" => "’", "less-than" => "<", "greater-than" => ">", "newline" => "\n<br>\n"); // Defines field-specific search & replace 'actions' that will be applied to the actual citation // for all those refbase fields that are listed in the corresponding 'fields' element: // (These search and replace actions will be performed *in addition* to those specified globally // in '$searchReplaceActionsArray' (defined in 'ini.inc.php'). Same rules apply as for // '$searchReplaceActionsArray'.) $fieldSpecificSearchReplaceActionsArray = array(array('fields' => array("abstract"), 'actions' => array("/[\r\n]+/" => "\n<br>\n"))); // In addition, for the "more info" section, we also substitute contents of the below 'fields' // with localized field values from variable '$loc'. Since the locales in '$loc' are already // HTML encoded, we have to exclude these fields from any further HTML encoding (done below). $fieldSpecificSearchReplaceActionsArray2 = $fieldSpecificSearchReplaceActionsArray; $fieldSpecificSearchReplaceActionsArray2[] = array('fields' => array("thesis", "approved", "marked", "copy", "selected"), 'actions' => array("/(.+)/e" => "\$loc['\\1']")); static $encodingExceptionsArray = array("thesis", "approved", "marked", "copy", "selected"); // LOOP OVER EACH RECORD: // Fetch one page of results (or less if on the last page) // (i.e., upto the limit specified in $showRows) fetch a row into the $row array and ... for ($rowCounter = 0; $rowCounter < $showRows && ($row = @mysql_fetch_array($result)); $rowCounter++) { $encodedRowData = $row; // we keep '$row' in its original (unencoded) form since unencoded data will be required by function 'linkifyFieldItems()' below // NOTES: - Currently, HTML encoding and search & replace actions are applied separately // for the citation and the "more info" section underneath the citation. The // actions in this 'foreach' block concern the actual citation // - It might be better to pass the unencoded '$row' data to function 'citeRecord()' // which would then make calls to function 'encodeField()' individually for each // field (similar to as it is done it 'modsxml.inc.php') foreach ($encodedRowData as $rowFieldName => $rowFieldValue) { // NOTES: - We HTML encode non-ASCII chars for all but the author & editor fields. The author & editor // fields are excluded here since these fields must be passed *without* HTML entities to the // 'reArrangeAuthorContents()' function (which will then handle the HTML encoding by itself) // - Function 'encodeField()' will also apply any field-specific search & replace actions $encodedRowData[$rowFieldName] = encodeField($rowFieldName, $rowFieldValue, $fieldSpecificSearchReplaceActionsArray, array("author", "editor")); // function 'encodeField()' is defined in 'include.inc.php' } // Order attributes according to the chosen output style & record type: $record = citeRecord($encodedRowData, $citeStyle, $citeType, $markupPatternsArray, true); // function 'citeRecord()' is defined in the citation style file given in '$citeStyleFile' (which, in turn, must reside in the 'cite' directory of the refbase root directory), see function 'generateCitations()' // Print out the current record: if (!empty($record)) { // Print any section heading(s): if (preg_match("/year|type/i", $citeOrder)) { if (preg_match("/^Mobile\$/i", $viewType)) { $headingPrefix = "\n<div class=\"sect\">"; $headingSuffix = "</div>"; } else { $headingPrefix = "\n<tr>" . "\n\t<td valign=\"top\" colspan=\"{$NoColumns}\">"; $headingSuffix = "</td>" . "\n</tr>"; } list($yearsArray, $typeTitlesArray, $sectionHeading) = generateSectionHeading($yearsArray, $typeTitlesArray, $row, $citeOrder, $headingPrefix, $headingSuffix, "<h4>", "</h4>", "<h5>", "</h5>"); // function 'generateSectionHeading()' is defined in 'cite.inc.php' $recordData .= $sectionHeading; } // Print out the record: if (is_integer($rowCounter / 2)) { // if we currently are at an even number of rows $rowClass = "even"; } else { $rowClass = "odd"; } if (preg_match("/^(cli|inc)/i", $client) or $wrapResults == "0") { // we use absolute links for CLI clients, for include mechanisms, or when returning only a partial document structure $baseURL = $databaseBaseURL; } else { $baseURL = ""; } $recordPermaLink = $databaseBaseURL . "show.php?record=" . $row["serial"]; // generate a permanent link for the current record if (preg_match("/^Mobile\$/i", $viewType)) { $recordData .= "\n<div class=\"" . $rowClass . "\">" . "\n\t<div class=\"citation\">" . $record . "</div>"; } else { $recordData .= "\n<tr class=\"" . $rowClass . "\">"; // Print a column with a checkbox: // Note: we omit the results footer in print/mobile view ('viewType=Print' or 'viewType=Mobile'), for CLI clients, and when outputting only a partial document structure ('wrapResults=0')! if (!preg_match("/^Print\$/i", $viewType) and !preg_match("/^cli/i", $client) and $wrapResults != "0" and (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden")) { $recordData .= "\n\t<td align=\"center\" valign=\"top\" width=\"10\">"; // - Print a checkbox form element: if (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden") { $recordData .= "\n\t\t<input type=\"checkbox\" onclick=\"updateAllRecs();\" name=\"marked[]\" value=\"" . $row["serial"] . "\" title=\"" . $loc["selectRecord"] . "\">"; } if (!empty($row["orig_record"])) { if (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden") { $recordData .= "\n\t\t<br>"; } if ($row["orig_record"] < 0) { $recordData .= "\n\t\t<img src=\"" . $baseURL . "img/ok.gif\" alt=\"(" . $loc["original"] . ")\" title=\"" . $loc["originalRecord"] . "\" width=\"14\" height=\"16\" hspace=\"0\" border=\"0\">"; } else { // $row["orig_record"] > 0 $recordData .= "\n\t\t<img src=\"" . $baseURL . "img/caution.gif\" alt=\"(" . $loc["duplicate"] . ")\" title=\"" . $loc["duplicateRecord"] . "\" width=\"5\" height=\"16\" hspace=\"0\" border=\"0\">"; } } // - Add <abbr> block which works as a microformat that allows applications to identify objects on web pages; see <http://unapi.info/specs/> for more info $recordData .= "\n\t\t<div class=\"unapi\"><abbr class=\"unapi-id\" title=\"" . $recordPermaLink . "\"></abbr></div>"; $recordData .= "\n\t</td>"; } // Print record data as a citation: $recordData .= "\n\t<td id=\"ref" . $row["serial"] . "\" class=\"citation\" valign=\"top\">" . "\n\t\t" . $record; // Display a triangle widget to show more info (keywords, abstract, etc) under each citation: if (!empty($additionalFieldsCitationView)) { // Map MySQL field names to localized column names: $fieldNamesArray = mapFieldNames(); // function 'mapFieldNames()' is defined in 'include.inc.php' if ($useVisualEffects == "yes") { $toggleVisibilityFunction = "toggleVisibilitySlide"; } else { $toggleVisibilityFunction = "toggleVisibility"; } $recordData .= "\n\t\t<div class=\"showhide\">" . "\n\t\t\t<a href=\"javascript:" . $toggleVisibilityFunction . "('moreinfo" . $row["serial"] . "','toggleimg" . $row["serial"] . "','toggletxt" . $row["serial"] . "','more%20info')\" title=\"" . $loc["LinkTitle_ToggleVisibility"] . "\">" . "<img id=\"toggleimg" . $row["serial"] . "\" class=\"toggleimg\" src=\"" . $baseURL . "img/closed.gif\" alt=\"" . $loc["LinkTitle_ToggleVisibility"] . "\" width=\"9\" height=\"9\" hspace=\"0\" border=\"0\">" . "</a>" . "\n\t\t</div>" . "\n\t\t<div id=\"moreinfo" . $row["serial"] . "\" class=\"moreinfo\" style=\"display: none;\">"; // Print additional fields: foreach ($additionalFieldsCitationView as $field) { if (isset($row[$field]) and !empty($row[$field])) { $recordData .= "\n\t\t\t<div class=\"" . $field . "\"><strong>" . $fieldNamesArray[$field] . ":</strong> "; // Make field items into clickable search links: if (in_array($displayType, $showFieldItemLinks)) { // Note: Function 'linkifyFieldItems()' will also call function 'encodeField()' to HTML // encode non-ASCII chars and to apply any field-specific search & replace actions $recordData .= linkifyFieldItems($field, $row[$field], $userID, $fieldSpecificSearchReplaceActionsArray2, $encodingExceptionsArray, "/\\s*[;]+\\s*/", "; ", $showQuery, $showLinks, $showRows, $citeStyle, $citeOrder, $wrapResults, $displayType, $viewType); } else { // don't hotlink field items $recordData .= encodeField($field, $row[$field], $fieldSpecificSearchReplaceActionsArray2, $encodingExceptionsArray); } // function 'encodeField()' is defined in 'include.inc.php' $recordData .= "</div>"; } } // Print a row with links for the current record: $recordData .= "\n\t\t\t<div class=\"reflinks\">"; // - Print the record's permanent URL: if (preg_match("/^inc/i", $client)) { // we open links in a new browser window if refbase data are included somewhere else: $target = " target=\"_blank\""; } else { $target = ""; } $recordData .= "\n\t\t\t\t<div class=\"permalink\"><a href=\"" . $recordPermaLink . "\"" . $target . " title=\"" . $loc["LinkTitle_Permalink"] . "\">"; if (preg_match("/^Print\$/i", $viewType)) { // for print view, we use the URL as link title $recordData .= $recordPermaLink; } else { $recordData .= $loc["PermalinkShort"]; } $recordData .= "</a></div>"; // - Print additional links to cite/export the current record: // Note: we omit the additional links in print view ('viewType=Print') if (!preg_match("/^Print\$/i", $viewType)) { // -- Print cite links: if (isset($_SESSION['user_permissions']) and preg_match("/allow_cite/", $_SESSION['user_permissions']) and isset($_SESSION['user_cite_formats'])) { $userCiteFormatsArray = preg_split("/ *; */", $_SESSION['user_cite_formats'], -1, PREG_SPLIT_NO_EMPTY); // get a list of the user's cite formats (the 'PREG_SPLIT_NO_EMPTY' flag causes only non-empty pieces to be returned) $recordData .= "\n\t\t\t\t<div class=\"citelinks\">" . " | " . $loc["SaveCitation"] . ":"; foreach ($userCiteFormatsArray as $citeFormat) { if (!preg_match("/^html\$/i", $citeFormat)) { // for now, we exclude the "HTML" cite format (as it's not any different to the regular Citation view HTML output) $recordData .= "\n\t\t\t\t\t <a href=\"" . $baseURL . generateURL("show.php", $citeFormat, array("record" => $row['serial']), true, "", "", $citeStyle, $citeOrder) . "\" title=\"" . $loc["LinkTitle_SaveCitationFormat_Prefix"] . $citeFormat . $loc["LinkTitle_SaveCitationFormat_Suffix"] . "\">" . $citeFormat . "</a>"; } } $recordData .= "\n\t\t\t\t</div>"; } // -- Print export links: if (isset($_SESSION['user_permissions']) and preg_match("/allow_export|allow_batch_export/", $_SESSION['user_permissions']) and isset($_SESSION['user_export_formats'])) { $userExportFormatsArray = preg_split("/ *; */", $_SESSION['user_export_formats'], -1, PREG_SPLIT_NO_EMPTY); // get a list of the user's export formats $recordData .= "\n\t\t\t\t<div class=\"exportlinks\">" . " | " . $loc["ExportRecord"] . ":"; foreach ($userExportFormatsArray as $exportFormat) { $recordData .= "\n\t\t\t\t\t <a href=\"" . $baseURL . generateURL("show.php", $exportFormat, array("record" => $row['serial'], "exportType" => "file"), true, "", "", $citeStyle) . "\" title=\"" . $loc["LinkTitle_ExportRecordFormat_Prefix"] . $exportFormat . $loc["LinkTitle_ExportRecordFormat_Suffix"] . "\">" . $exportFormat . "</a>"; } $recordData .= "\n\t\t\t\t</div>"; } } $recordData .= "\n\t\t\t</div>" . "\n\t\t</div>"; } $recordData .= "\n\t</td>"; } // Display the regular links column: if ($showLinks == "1") { if (preg_match("/^Mobile\$/i", $viewType)) { $recordData .= "\n\t<div class=\"links\">"; } else { $recordData .= "\n\t<td class=\"links\" valign=\"top\" width=\"42\">"; } // Print out available links: // for Citation view, we'll use the '$showLinkTypesInCitationView' array that's defined in 'ini.inc.php' // to specify which links shall be displayed (if available and if 'showLinks == 1') // (for links of type DOI/URL/ISBN/XREF, only one link will be printed; order of preference: DOI, URL, ISBN, XREF) $recordData .= printLinks($showLinkTypesInCitationView, $row, $showQuery, $showLinks, $wrapResults, $userID, $viewType, $orderBy); // function 'printLinks()' is defined in 'search.php' if (preg_match("/^Mobile\$/i", $viewType)) { $recordData .= "\n\t</div>"; } else { $recordData .= "\n\t</td>"; } } if (preg_match("/^Mobile\$/i", $viewType)) { $recordData .= "\n</div>"; } else { $recordData .= "\n</tr>"; } } } // OUTPUT RESULTS: // Note: we omit the results header, browse links & query form for CLI clients, and when outputting only a partial document structure ('wrapResults=0') if (!preg_match("/^cli/i", $client) and $wrapResults != "0") { // Note: we also omit the results header in print/mobile view ('viewType=Print' or 'viewType=Mobile') if (!preg_match("/^(Print|Mobile)\$/i", $viewType) and (!isset($displayResultsHeaderDefault[$displayType]) or isset($displayResultsHeaderDefault[$displayType]) and $displayResultsHeaderDefault[$displayType] != "hidden")) { // Extract the first field from the 'WHERE' clause: if (preg_match("/ WHERE [ ()]*(\\w+)/i", $query)) { $selectedField = preg_replace("/.+ WHERE [ ()]*(\\w+).*/i", "\\1", $query); } else { $selectedField = "author"; } // in the 'Search within Results" form, we'll select the 'author' field by default // Map MySQL field names to localized column names: $fieldNamesArray = mapFieldNames(true); $localizedDropDownFieldsArray = array(); if (isset($_SESSION['loginEmail']) and !empty($defaultDropDownFieldsLogin)) { // if a user is logged in -AND- there were any additional fields specified... $dropDownFieldsArray = array_merge($defaultDropDownFieldsEveryone, $defaultDropDownFieldsLogin); } else { $dropDownFieldsArray = $defaultDropDownFieldsEveryone; } foreach ($dropDownFieldsArray as $field) { if (isset($fieldNamesArray[$field])) { $localizedDropDownFieldsArray[$field] = $fieldNamesArray[$field]; } else { // no localized field name exists, so we use the original field name $localizedDropDownFieldsArray[$field] = $field; } } // Get all citation styles for the current user: if (!isset($_SESSION['user_styles'])) { $citationStylesArray = array($defaultCiteStyle); } else { $citationStylesArray = array(); $citationStylesTempArray = preg_split("/ *; */", $_SESSION['user_styles']); // get the user's list of citation styles foreach ($citationStylesTempArray as $citationStyle) { $citationStylesArray[$citationStyle] = $citationStyle; } } // 2) Build forms containing options to show the user's groups, refine the search results or change the displayed columns: // TODO for 2b+2c: should we allow users to choose via the web interface which columns are included in the popup menus? // 2a) Build a FORM with a popup containing the user's groups: $formElementsGroup = buildGroupSearchElements("search.php", $queryURL, $query, $showQuery, $showLinks, $showRows, $citeStyle, $citeOrder, $displayType); // function 'buildGroupSearchElements()' is defined in 'include.inc.php' // 2b) Build a FORM containing options to refine the search results: // Call the 'buildRefineSearchElements()' function (defined in 'include.inc.php') which does the actual work: $formElementsRefine = buildRefineSearchElements("search.php", $queryURL, $showQuery, $showLinks, $showRows, $citeStyle, $citeOrder, $localizedDropDownFieldsArray, $selectedField, $displayType); // 2c) Build a FORM containing display options (change citation style & sort order, or change the number of records displayed per page): // Call the 'buildDisplayOptionsElements()' function (defined in 'include.inc.php') which does the actual work: $formElementsDisplayOptions = buildDisplayOptionsElements("search.php", $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $citeStyle, $citeOrder, $citationStylesArray, $citeStyle, 2, $displayType, $headerMsg); $htmlData .= displayResultsHeader("search.php", $formElementsGroup, $formElementsRefine, $formElementsDisplayOptions, $displayType); // function 'displayResultsHeader()' is defined in 'results_header.inc.php' // and insert a divider line (which separates the results header from the browse links & results data below): $htmlData .= "\n<hr class=\"resultsheader\" align=\"center\" width=\"93%\">"; } // Build a TABLE with links for "previous" & "next" browsing, as well as links to intermediate pages // call the 'buildBrowseLinks()' function (defined in 'include.inc.php'): $BrowseLinks = buildBrowseLinks("search.php", $query, $NoColumns, $rowsFound, $showQuery, $showLinks, $showRows, $rowOffset, $previousOffset, $nextOffset, $wrapResults, $maximumBrowseLinks, "sqlSearch", "Cite", $citeStyle, $citeOrder, $orderBy, $headerMsg, $viewType); $htmlData .= $BrowseLinks; if (preg_match("/^Mobile\$/i", $viewType)) { // Extract the original OpenSearch/CQL query that was saved by 'opensearch.php' as a session variable: if (isset($_SESSION['cqlQuery'])) { $cqlQuery = $_SESSION['cqlQuery']; } else { $cqlQuery = ""; } // Include an OpenSearch-style (CQL) query form: $htmlData .= "\n<div id=\"queryform\">" . "\n\t<form action=\"opensearch.php\" method=\"GET\" name=\"openSearch\">" . "\n\t\t<input type=\"hidden\" name=\"formType\" value=\"openSearch\">" . "\n\t\t<input type=\"hidden\" name=\"submit\" value=\"" . $loc["ButtonTitle_Search"] . "\">" . "\n\t\t<input type=\"hidden\" name=\"viewType\" value=\"" . $viewType . "\">" . "\n\t\t<input type=\"hidden\" name=\"startRecord\" value=\"1\">" . "\n\t\t<input type=\"hidden\" name=\"maximumRecords\" value=\"" . $showRows . "\">" . "\n\t\t<input type=\"hidden\" name=\"recordSchema\" value=\"html\">" . "\n\t\t<input type=\"text\" name=\"query\" value=\"" . $cqlQuery . "\" size=\"25\" title=\"" . $loc["DescriptionEnterSearchString"] . "\">" . "\n\t\t<input type=\"submit\" name=\"submit\" value=\"" . $loc["ButtonTitle_Search"] . "\" title=\"" . $loc["DescriptionSearchDB"] . "\">" . "\n\t</form>" . "\n</div>"; } elseif (!preg_match("/^Print\$/i", $viewType) and (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden")) { // Include the 'queryResults' form: $htmlData .= "\n<form action=\"search.php\" method=\"GET\" name=\"queryResults\">" . "\n<input type=\"hidden\" name=\"formType\" value=\"queryResults\">" . "\n<input type=\"hidden\" name=\"submit\" value=\"Cite\">" . "\n<input type=\"hidden\" name=\"originalDisplayType\" value=\"" . $displayType . "\">" . "\n<input type=\"hidden\" name=\"orderBy\" value=\"" . rawurlencode($orderBy) . "\">" . "\n<input type=\"hidden\" name=\"showQuery\" value=\"" . $showQuery . "\">" . "\n<input type=\"hidden\" name=\"showLinks\" value=\"" . $showLinks . "\">" . "\n<input type=\"hidden\" name=\"showRows\" value=\"" . $showRows . "\">" . "\n<input type=\"hidden\" name=\"rowOffset\" value=\"" . $rowOffset . "\">" . "\n<input type=\"hidden\" name=\"sqlQuery\" value=\"" . $queryURL . "\">"; // embed the current sqlQuery so that it can be re-applied after the user pressed either of the 'Add' or 'Remove' buttons within the 'queryResults' form } } // Output query results: if (preg_match("/^Mobile\$/i", $viewType)) { $htmlData .= "\n<div id=\"citations\" class=\"results\">" . $recordData . "\n</div>"; } else { $htmlData .= "\n<table id=\"citations\" class=\"results\" align=\"center\" width=\"100%\" summary=\"This table holds the database results for your query\">" . $recordData . "\n</table>"; } // Append the footer: // Note: we omit the results footer & browse links in print/mobile view ('viewType=Print' or 'viewType=Mobile'), for CLI clients, and when outputting only a partial document structure ('wrapResults=0')! if (!preg_match("/^(Print|Mobile)\$/i", $viewType) and !preg_match("/^cli/i", $client) and $wrapResults != "0") { // Again, insert the (already constructed) BROWSE LINKS // (i.e., a TABLE with links for "previous" & "next" browsing, as well as links to intermediate pages) $htmlData .= $BrowseLinks; // Build a results footer with form elements to cite, group or export all/selected records: if (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden") { if (isset($_SESSION['user_permissions']) and (isset($_SESSION['loginEmail']) and preg_match("/allow_cite|allow_user_groups|allow_export|allow_batch_export/", $_SESSION['user_permissions']) or !isset($_SESSION['loginEmail']) and preg_match("/allow_cite/", $_SESSION['user_permissions']))) { // if the 'user_permissions' session variable does contain any of the following: 'allow_cite' -AND- if logged in, aditionally: 'allow_user_groups', 'allow_export', 'allow_batch_export'... // ...Insert a divider line (which separates the results data from the forms in the footer): $htmlData .= "\n<hr class=\"resultsfooter\" align=\"center\">"; } // Call the 'buildResultsFooter()' function (which does the actual work): $htmlData .= buildResultsFooter($showRows, $citeStyle, $citeOrder, $displayType, $headerMsg); } } if (!preg_match("/^(Print|Mobile)\$/i", $viewType) and !preg_match("/^cli/i", $client) and $wrapResults != "0" and (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden")) { // Finish the form: $htmlData .= "\n</form>"; } return $htmlData; }
// contains a 'show.php' URL and not e.g. a '*_search.php' URL; this, in turn, can prevent the "NoPermission_ForSQL" warning // if a user clicked the "Show All" link in the header of any of the '*_search.php' pages // (see notes above the "NoPermission_ForSQL" error message in 'search.php') // if (isset($_SERVER['REQUEST_URI'])) // saveSessionVariable("referer", $_SERVER['REQUEST_URI']); // function 'saveSessionVariable()' is defined in 'include.inc.php' // Call 'search.php' in order to display record details: if ($_SERVER['REQUEST_METHOD'] == "POST") { // save POST data to session variable: // NOTE: If the original request was a POST (as is the case for the refbase command line client) saving POST data to a session // variable allows to retain large param/value strings (that would exceed the maximum string limit for GET requests). // 'search.php' will then write the saved POST data back to '$_POST' and '$_REQUEST'. (see also note and commented code below) saveSessionVariable("postData", $queryParametersArray); header("Location: search.php?client=" . $client); // we also pass the 'client' parameter in the GET request so that it's available to 'search.php' before sessions are initiated } else { $queryURL = generateURL("search.php", "html", $queryParametersArray, false); // function 'generateURL()' is defined in 'include.inc.php' header("Location: {$queryURL}"); } // NOTE: If the original request was a POST (as is the case for the refbase command line client), we must also pass the data via POST to 'search.php' // in order to retain large param/value strings (that would exceed the maximum string limit for GET requests). We could POST the data via function // 'sendPostRequest()' as shown in the commented code below. However, the problem with this is that this does NOT *redirect* to 'search.php' but // directly prints results from within this script ('show.php'). Also, the printed results include the full HTTP response, including the HTTP header. // $queryURL = ""; // foreach ($queryParametersArray as $varname => $value) // $queryURL .= "&" . $varname . "=" . rawurlencode($value); // $queryURL = trimTextPattern($queryURL, "&", true, false); // remove again param delimiter from beginning of query URL (function 'trimTextPattern()' is defined in 'include.inc.php') // // if ($_SERVER['REQUEST_METHOD'] == "POST") // redirect via a POST request: // { // // extract the host & path on server from the base URL:
/** * Get link to blog category. * @return Link to blog category. */ function getBlogCategoryLink($categoryId, $categoryTitle = "") { global $dbi, $settings; if ($settings->linkType == 1 || $settings->linkType == 3) { // Check if blog with same title exists $multiple = false; $result = $dbi->query("SELECT title FROM " . blogTableName . " WHERE title=" . $dbi->quote($this->title) . " AND id!=" . $dbi->quote($this->id)); if ($result->rows()) { $multiple = true; } if ($categoryId != 0) { if (empty($categoryTitle)) { $result = $dbi->query("SELECT id,title FROM " . categoryTableName . " WHERE id=" . $dbi->quote($categoryId)); if ($result->rows()) { list($categoryId, $categoryTitle) = $result->fetchrow_array(); } } if (!empty($categoryTitle)) { return generateURL(scriptUrl . "/" . folderBlog . "/" . fileBlog, array($this->title, $multiple || $settings->linkType == 3 ? $this->id : "_", $categoryTitle)); } } else { // Include language include scriptPath . "/" . folderBlog . "/include/language/" . $this->language . "/general.php"; return generateURL(scriptUrl . "/" . folderBlog . "/" . fileBlog, array($this->title, $multiple || $settings->linkType == 3 ? $this->id : "_", $lBlogPost["Uncategorized"])); } // Free result set $result->finish(); } return scriptUrl . "/" . folderBlog . "/" . fileBlog . "?blogId=" . $this->id . "&categoryId=" . $categoryId; }
$("#entries_upload_create").attr("disabled", "true"); var file = $("#upload_files")[0].files[0]; if (file.name==undefined) { alert("Error: Browser unsupported."); return; } var request = new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState==4) { $("#entries_upload_load").text(request.responseText); $("#upload_files")[0].form.reset(); $("#upload_files").removeAttr("disabled"); $("#entries_upload_create").removeAttr("disabled"); loadMembers(); } } request.open("post", "<?php echo generateURL("api/members/upload"); ?> ", true); request.setRequestHeader("Cache-Control", "no-cache"); request.setRequestHeader("X-FILENAME", file.name); request.setRequestHeader("Content-Type", "multipart/form-data"); request.send(file); }); loadMembers(); }); </script> <?php require_once "footer.php"; exit;
$("#users_list").on("click", "tbody tr", function() { $("#user_edit_id").text($(this).find(".id").text()); $("#user_edit_email").val($(this).find(".email").text()); $("#user_edit_level").val($(this).find(".level").attr("value")); $("#user_edit").modal(); }); $("#user_edit_save").click(function() { $("#user_edit_load").load("<?php echo generateURL("api/users/update"); ?> /", {id: $("#user_edit_id").text(), email: $("#user_edit_email").val(), password: $("#user_edit_password").val(), level: $("#user_edit_level").val()}, function(response, status, xhr) { loadUsers(); }); }); $("#add_user").click(function() { $("#user_add").modal(); }); $("#user_add_create").click(function() { $("#user_add_load").load("<?php echo generateURL("api/users/create"); ?> /", {email: $("#user_add_email").val(), password: $("#user_add_password").val(), level: $("#user_add_level").val()}, function(response, status, xhr) { loadUsers(); }); }); loadUsers(); }); </script> <?php require_once "footer.php"; exit;
function viewTeam() { global $user; $UID = $user->uid; $params = drupal_get_query_parameters(); $array = array(); // checks to see if the user has a team if (isset($params['TID'])) { $TID = $params['TID']; } else { drupal_set_message("No team selected.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } // checks to see if the user is on the team (keeping in mind that team owners can // see their team application if (dbGetTeamOwner($TID) != $UID && (!isMyTeam($TID) || teamIsIneligible($TID))) { drupal_set_message('You do not have permission to access this page.', 'error'); return; } $team = dbGetTeam($TID); $markup = ''; $markup .= '<div style="float:left; width:38%">'; // create team header and table $markup .= '<table style="margin:0px 0px 10px 0px;"><tr>'; $markup .= '<td style="padding:0px 14px 10px 14px;"><div align="left"><h2 style="margin:0px 0px 7px 0px;"><b>'; // if the team has a type if ($team['type'] != "Other") { $markup .= "{$team['type']} {$team['number']} - {$team['name']}"; } else { $markup .= "Team {$team['number']} - {$team['name']}"; } $markup .= '</b></h2></div></td></tr></table>'; // create table $markup .= '<table id="photoAndEdit"><tr><td style="padding:0px;">'; // if the user can edit team picture if (hasPermissionForTeam('editTeam', $TID)) { $markup .= '<div align="right">'; $markup .= '<a href= "?q=editThumbnail'; $markup .= '&TID=' . $TID . '&FID=' . $team['FID'] . '">'; $markup .= '<span title="Edit Photo"><button><img class="editIcon" src="/images/icons/editThumbnailWhite.png"></button></span></a>'; $markup .= '</div>'; } else { // otherwise show just a disabled button $markup .= '<div align="right">'; $markup .= '<span title="Edit Photo"><button type="button" disabled><img class="editIcon" src="/images/icons/editThumbnailWhite.png"></button></span>'; $markup .= '</div>'; } $markup .= '</td></tr><tr><td style="padding:0px;">'; // if the team has a picture then display if (!empty($team['FID'])) { $url = generateURL($team['FID']); $markup .= '<div align="center"><img src="' . $url . '" style="max-width:150px; width:auto; height:auto; padding: 5px 0px 5px 0px">'; // default team picture } else { $markup .= '<div align="center"><img src= "/images/defaultPics/team.png" style="max-width:200px; width:auto; height:auto; padding: 15px 0px 15px 0px">'; } $markup .= '</div></td></tr></table></div>'; $teams = dbGetTeamsForUser($UID); $markup .= '<div align="right">'; // if the user can permission to manage outreach if (!teamIsIneligible($TID) && hasPermissionForTeam('manageOutreachTags', $TID)) { $markup .= '<a href="?q=teamModeratorPage">'; $markup .= '<div class="help tooltip4">'; $markup .= '<button>Moderators</button>'; $markup .= '<span id="helptext"; class="helptext tooltiptext4">'; $markup .= 'Click here to view ideas, write-ups, and hours awaiting approval.'; $markup .= '</span></div></a>'; } else { $markup .= '<div class="help tooltip4">'; $markup .= '<button type="button" disabled>Moderators</button>'; $markup .= '<span id="helptext"; class="helptext tooltiptext4">'; $markup .= 'Click here to view ideas, write-ups, and hours awaiting approval.'; $markup .= '</span></div>'; } // if the user can manage the outreach settings (currently only tags) if (!teamIsIneligible($TID) && hasPermissionForTeam('manageOutreachTags', $TID)) { $markup .= '<a href="?q=teamOutreachSettings">'; $markup .= '<button>Settings</button></a>'; } else { $markup .= '<button type="button" disabled>Settings</button>'; } // if the user has permission to manage hours if (!teamIsIneligible($TID) && hasPermissionForTeam('editAnyHours', $TID)) { $markup .= '<a href= "?q=offsetHours'; $markup .= '&TID=' . $team['TID'] . '">'; $markup .= '<div class="help tooltip4">'; $markup .= '<button type="button"><img class="hoursIcon" src="/images/icons/clockWhite.png"></button>'; $markup .= '<span id="helptext"; class="helptext tooltiptext4">'; $markup .= 'Click here to enter old team hours from previous years.'; $markup .= '</span></div></a>'; } else { $markup .= '<div class="help tooltip4">'; $markup .= '<button type="button" disabled><img class="hoursIcon" src="/images/icons/clockWhite.png"></button>'; $markup .= '<span id="helptext"; class="helptext tooltiptext4">'; $markup .= 'Click here to enter old team hours from previous years.'; $markup .= '</span></div>'; } // if the user can edit the team if (hasPermissionForTeam('editTeam', $TID)) { $markup .= '<a href= "?q=teamForm&url=viewTeam'; $markup .= '&TID=' . $team['TID'] . '">'; $markup .= '<button type="button"><img class="editIcon" src="/images/icons/editWhite.png"></button></a>'; } else { $markup .= '<button type="button" disabled><img class="editIcon" src="/images/icons/editWhite.png"></button></a>'; } // if the user can delete the team if (hasPermissionForTeam('deleteTeam', $TID)) { $markup .= '<a href= "?q=deleteTeamPage'; $markup .= '&TID=' . $team['TID'] . '">'; $markup .= '<button type="button"><img class="trashIcon" src="/images/icons/trashWhite.png"></button></a>'; } else { $markup .= '<button type="button" disabled><img class="trashIcon" src="/images/icons/trashWhite.png"></button></a>'; } $markup .= '</div>'; // begin displaying info $markup .= '<div style="width:60%; float:right; padding-left:10px">'; $teams = dbGetTeamsForUser($UID); $numOutreaches = dbGetNumOutreachForTeam($TID); // create table $markup .= '<table id="miniViewTeam" style="margin:16px 0px 0px 0px"><tr><td><b>'; if ($numOutreaches != 0) { $markup .= '<a href="?q=outreach&allTeamOutreach">Outreaches: </a></b>'; } else { $markup .= 'Outreaches: </b>'; } $markup .= $numOutreaches . '</td>'; $markup .= '<td><b>Total Number of Hours: </b>' . dbGetHoursForTeam($TID) . '</td></tr>'; $markup .= '<tr><td><b><a href="?q=showUsersForTeam'; $numStudents = dbGetNumStudentsForTeam($team['TID']); $numMentors = dbGetNumMentorsForTeam($team['TID']); $markup .= '&TID=' . $team['TID'] . '&type=student">Students: </a></b>' . dbGetNumStudentsForTeam($team['TID']) . '</td>'; $markup .= '<td><b><a href="?q=showUsersForTeam'; $markup .= '&TID=' . $team['TID'] . '&type=mentor">Mentors: </a></b>' . dbGetNumMentorsForTeam($team['TID']) . '</td></tr>'; $markup .= '<tr><td><b>City: </b>' . $team['city'] . '</td>'; $markup .= '<td><b>State: </b>' . $team['state'] . '</td></tr>'; $markup .= '<tr><td><b>Country: </b>' . $team['country'] . '</td>'; $markup .= '<td><b>Rookie Year: </b>' . $team['rookieYear'] . '</td></tr>'; if ($team['rookieYear'] == NULL) { $team['rookieYear'] = '[none]'; } $markup .= '</table></div>'; return array('#markup' => $markup); }
<span class="glyphicon glyphicon-chevron-left"></span> </a> <?php } } else { ?> <a href="<?php echo generateURL($_GET["c"], 'add'); ?> " class="pull-right"> <span class="glyphicon glyphicon-plus"></span> </a> <?php } } else { ?> <a href="<?php echo generateURL(DEFAULT_CONTROLLER, 'add'); ?> " class="pull-right"> <span class="glyphicon glyphicon-plus"></span> </a> <?php } } }
<span class="glyphicon glyphicon-user"></span> STAFF </a> </li> <!-- <li> <a href="<?php //echo generateURL('info', 'list') ?> "> <span class="glyphicon glyphicon-file"></span> INFORMATE </a> </li> --> <li> <a href="<?php echo generateURL('post', 'list'); ?> "> <span class="glyphicon glyphicon-th"></span> PRENSA </a> </li> </ul> </nav> </aside> <?php } ?> <div id="content" class="pull-right"> <?php
echo generateURL("api/sidebar/update"); ?> /", {id: $("#sidebar_edit_id").text(), title: $("#sidebar_edit_title").val(), url: $("#sidebar_edit_url").val(), order: $("#sidebar_edit_order").val()}, function(response, status, xhr) { loadSidebar(); }); }); $("#sidebar_edit_delete").click(function() { $("#sidebar_edit_load").load("<?php echo generateURL("api/sidebar/delete"); ?> /", {id: $("#sidebar_edit_id").text()}, function(response, status, xhr) { loadSidebar(); }); }); $("#add_sidebar_item").click(function() { $("#sidebar_add").modal(); }); $("#sidebar_add_button").click(function() { $("#sidebar_add_load").load("<?php echo generateURL("api/sidebar/add"); ?> /", {title: $("#sidebar_edit_title").val(), url: $("#sidebar_edit_url").val(), order: $("#sidebar_edit_order").val()}, function(response, status, xhr) { loadSidebar(); }); }); loadSidebar(); }); </script> <?php require_once "footer.php"; exit;
echo generateURL("api/announcements/list"); ?> /", function(response, status, xhr) { }); } $(document).ready(function() { $("#add").click(function() { $("#announcement_add").modal(); }); $("#announcement_add_create").click(function() { if ($("#announcement_add_smsmessage").val().length>160) { alert("SMS Message is too big, cannot send."); } else { $("#announcement_add_load").load("<?php echo generateURL("api/announcements/send"); ?> /", {subject: $("#announcement_add_subject").val(), message: $("#announcement_add_message").val(), smsmessage: $("#announcement_add_smsmessage").val()}, function(response, status, xhr) { if ($("#announcement_add_load").text()=="Successfully Sent.") { $("#announcement_add_subject").val(""); $("#announcement_add_message").val(""); $("#announcement_add_smsmessage").val(""); $("#announcement_add").modal("hide"); } loadAnnouncements(); }); } }); loadAnnouncements(); });
// (4b) DISPLAY results: // construct the correct SQL query that will link back to the added/edited record: $sqlQuery = buildSELECTclause("Display", "1", "", true, false); // function 'buildSELECTclause()' is defined in 'include.inc.php' if (isset($_SESSION['loginEmail'])) { // if a user is logged in, show user specific fields: $sqlQuery .= " FROM {$tableRefs} LEFT JOIN {$tableUserData} ON serial = record_id AND user_id = " . quote_smart($loginUserID) . " WHERE serial RLIKE " . quote_smart("^(" . $serialNo . ")\$") . " ORDER BY author, year DESC, publication"; } else { // if NO user logged in, don't display any user specific fields: $sqlQuery .= " FROM {$tableRefs} WHERE serial RLIKE " . quote_smart("^(" . $serialNo . ")\$") . " ORDER BY author, year DESC, publication"; } // we simply use the fixed default ORDER BY clause here $sqlQuery = rawurlencode($sqlQuery); // Generate a 'search.php' URL that points to the formerly displayed results page: if (!empty($oldMultiRecordQuery)) { $oldMultiRecordQueryURL = generateURL("search.php", "html", $oldMultiRecordQuery, true); } // function 'generateURL()' is defined in 'include.inc.php' // Build a TABLE, containing one ROW and DATA tag: echo "\n<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"10\" width=\"95%\" summary=\"This table holds links to the added/edited records as well as to the previously displayed search results page\">" . "\n<tr>" . "\n\t<td valign=\"top\">" . "\n\t\tChoose how to proceed: "; if (isset($_SESSION['user_permissions']) and preg_match("/allow_details_view/", $_SESSION['user_permissions'])) { if ($recordAction != "delet") { echo "\n\t\t<a href=\"search.php?sqlQuery=" . $sqlQuery . "&showQuery=0&showLinks=1&formType=sqlSearch&submit=Display\">Show " . $recordAction . "ed record</a>"; } if ($recordAction != "delet" && !empty($oldMultiRecordQuery)) { echo "\n\t\t -OR- "; } } if (!empty($oldMultiRecordQuery)) { // only provide a link to any previous search results if '$oldMultiRecordQuery' isn't empty echo "\n\t\t<a href=\"" . $oldMultiRecordQueryURL . "\">Display previous search results</a>";
/** * Generate a URL based on the application * @param string * @param array * @param boolean * @return string * @access public */ public function generateURL($app = NULL, $params = array(), $amp = TRUE) { // the app name is strtolower (url compatibility) // so that we can be sure that we can find a match in the config routing $app = strtolower($app); // go ahead and search through the routing $key = $this->getConfig()->findPath($app); // if we didn't find a match, just do generateSelfURL if ($key === FALSE) { return generateSelfURL($params, $amp); } // create the base url. this means getting the config's base, which is something // like the script name of the entry point. add on the app's routing url. $base = $this->getConfig()->getBase(); // add an ending slash to base if we need to $base .= substr($base, -1) == '/' ? '' : '/'; // only add a trailing slash if this isn't a php file (GAIA) $base .= substr($key, -4) != '.php' ? $key . '/' : $key; // if we don't have any dynamic params, we are done ... returns the app url if (!is_array($params)) { return generateURL($base, array(), $amp); } // order the params so that we get all the non-assoc. keyed elements first, // then everything else uksort($params, 'strnatcasecmp'); // initialize an array for parameters // if the parameter was a int, it becomes // part of the URL $p = array(); foreach ($params as $k => $v) { if (is_int($k)) { $base .= $v . '/'; continue; } $p[$k] = $v; } // generate the self url return generateURL($base, $p, $amp); }
function generateCodeId($tries = 0) { $code_id = generateURL(); if ($tries > 2) { $code_id .= $tries; } // check if it's free $sql = sprintf('select id from sandbox where url="%s"', mysql_real_escape_string($code_id)); $result = mysql_query($sql); // Check that the returned value is valid if (!$result) { die('Invalid query: ' . mysql_error()); } if (mysql_num_rows($result)) { $code_id = generateCodeId(++$tries); } else { if ($tries > 10) { echo 'Too many tries to find a new code_id - please contact using <a href="/about">about</a>'; exit; } } return $code_id; }
<?php // // logout.php // IT Club // // Copyright (c) 2015, Mr. Gecko's Media (James Coleman) // All rights reserved. // // The log out page. // databaseQuery("UPDATE users SET time=%d WHERE docid=%s", $_MGM['time'], $_MGM['user']['docid']); setcookie("{$_MGM['CookiePrefix']}user_email", "", $_MGM['time'], $_MGM['CookiePath'], $_MGM['CookieDomain']); setcookie("{$_MGM['CookiePrefix']}user_password", "", $_MGM['time'], $_MGM['CookiePath'], $_MGM['CookieDomain']); header("location: " . generateURL("login")); exit;
// Extract the view type requested by the user (either 'Mobile', 'Print', 'Web' or ''): // ('' will produce the default 'Web' output style) if (isset($_REQUEST['viewType'])) { $viewType = $_REQUEST['viewType']; } else { $viewType = ""; } // Setup an array of arrays holding URL and title information for all RSS feeds available on this page: // (appropriate <link...> tags will be included in the HTML header for every URL specified) $rssURLArray = array(); if (isset($_SESSION['user_permissions']) and preg_match("/allow_rss_feeds/", $_SESSION['user_permissions'])) { $showRows = $_SESSION['userRecordsPerPage']; // get the default number of records per page preferred by the current user $rssURLArray[] = array("href" => generateURL("show.php", $defaultFeedFormat, array("where" => 'serial RLIKE ".+"'), true, $showRows), "title" => "records added most recently"); $rssURLArray[] = array("href" => generateURL("show.php", $defaultFeedFormat, array("where" => 'created_date = CURDATE()'), true, $showRows), "title" => "records added today"); $rssURLArray[] = array("href" => generateURL("show.php", $defaultFeedFormat, array("where" => 'modified_date = CURDATE()'), true, $showRows), "title" => "records edited today"); } // -------------------------------------------------------------------- // Adjust the width of the right-hand column according to the calling user agent: // NOTE: strictly, this isn't really necessary but it helps to achieve a similar appearance of the login form on Firefox/Gecko & Safari/WebKit browsers (with all supported GUI languages) // TODO: figure out a better way (which isn't based on user agent sniffing); the problem could also be avoided by simply stacking <input> fields & their labels on top of each other if (isset($_SERVER['HTTP_USER_AGENT']) and preg_match("/AppleWebKit/i", $_SERVER['HTTP_USER_AGENT'])) { $rightColumnWidth = "215"; } else { $rightColumnWidth = "225"; } // Get the total number of records: $recordCount = getTotalNumberOfRecords(); // function 'getTotalNumberOfRecords()' is defined in 'include.inc.php' // Show the login status: showLogin();
} // add FROM clause if (!empty($searchArray)) { // Build WHERE clause: $query .= " WHERE"; appendToWhereClause($searchArray); // function 'appendToWhereClause()' is defined in 'include.inc.php' } // Build ORDER BY clause: $query .= " ORDER BY serial"; // -------------------------------------------------------------------- // Build the correct query URL: // (we skip unnecessary parameters here since 'search.php' will use it's default values for them) $queryParametersArray = array("sqlQuery" => $query, "formType" => "sqlSearch", "showLinks" => $showLinks, "exportStylesheet" => $exportStylesheet); // call 'search.php' with the correct query URL in order to display record details: $queryURL = generateURL("search.php", $exportFormat, $queryParametersArray, false, $showRows, $rowOffset); // function 'generateURL()' is defined in 'include.inc.php' header("Location: {$queryURL}"); } // ------------------------------------------------------------------------------------------------------------------- // Return a diagnostic error message: function returnDiagnostic($diagCode, $diagDetails) { global $exportContentType; global $contentTypeCharset; // '$contentTypeCharset' is defined in 'ini.inc.php' global $exportStylesheet; // use an appropriate default stylesheet: if ($exportStylesheet == "DEFAULT") { $exportStylesheet = ""; }