Ejemplo n.º 1
1
		<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
		
	    <!-- Title -->
		<title><?php 
print TITLE;
?>
 - Statistik</title>
	</head>
	<body>
		<header class="header">
            <p>ShortMe</p>
            <nav>               
				<a href="index.php">Shortener</a>
				<a href="statistik.php">Statistik</a>                
            </nav>
        </header>	
	    <div class="sbox center">
		    <header>
                <p>Shortener</p>
            </header>
		    <h2>Der ID zugewiesene Links</h2>
			<?php 
printLinks();
?>
		</div>
		<br>
        <?php 
include_once "content/footer.html";
?>
	 </body>
</html>
</head>
<body>

	<h1 class="testTitle">Dijit Test Matrix Table</h1>

	<table id="testMatrix">
		<thead>
			<tr class="top"><th rowspan="2">Test</th><th colspan="4">Tundra</th><th colspan="4">Nihilo</th><th colspan="4">Soria</th></tr>
			<tr class="tests"><th>Normal</th><th>a11y</th><th>rtl</th><th>a11y + rtl<th>Normal</th><th>a11y</th><th>rtl</th><th>a11y + rtl<th>Normal</th><th>a11y</th><th>rtl</th><th>a11y + rtl</tr>
		</thead>
		<tbody><?php 
printLinks(".", "Base Dijit Tests");
printLinks("./form", "Dijit Form Widget Tests");
printLinks("./layout", "Dijit Layout Widget Tests");
printLinks("./tree", "Dijit Tree Tests");
?>
		</tbody>
	</table>

</body>
</html>
<?php 
function printLinks($path, $group)
{
    $handle = opendir($path);
    $i = 0;
    print "<tr class='spacer'><td colspan='13'>" . $group . "</td></tr>";
    while (false !== ($file = readdir($handle))) {
        if (preg_match("/(test_|demo_)(.*)\\.html/", $file, $matches)) {
            $base = $matches[0];
			<tr class="top"><th rowspan="2">Test</th><th colspan="4">Tundra</th><th colspan="4">Nihilo</th><th colspan="4">Soria</th></tr>
			<tr class="tests"><th>Normal</th><th>a11y</th><th>rtl</th><th>a11y + rtl<th>Normal</th><th>a11y</th><th>rtl</th><th>a11y + rtl<th>Normal</th><th>a11y</th><th>rtl</th><th>a11y + rtl</tr>
		</thead>
		<tbody><?php 
foreach (getprojects() as $project) {
    $note = "";
    if ($project['readme']) {
        $note = "<a class='readmeLink' href='" . $project['readme'] . "'>about</a>";
    }
    if ($project['tests'] || $project['demos']) {
        print "<tr class='spacer'><td colspan='13'><span class='projectname'>dojox." . $project['name'] . "</span> " . $note . "</td></tr>";
        if ($project['tests']) {
            printLinks($project['tests']);
        }
        if ($project['demos']) {
            printLinks($project['demos']);
        }
    }
}
//	printLinks("./tree","Dijit Tree Tests");
?>
		</tbody>
	</table>

	<p>* note: All themes and modes included for completeness. Some projects don't even use themes. The "basic" link
		is the direct link to the file with no enhancements. The test file must include _testCommon from dijit to
		include theme / rtl / a11y testing capabilities.</p>
</body>
</html>
<?php 
function getprojects()
<?php 
//Задача #4:
//Да се създаде функция, която приема масив съдържащ масиви с по 2 елемента и конструира HTML от тях, използващ функцията от задача 1.
//Примерно извикване: $arr = array(array('http://abv.bg/', 'Абв поща'),array('http://gbg.bg/', 'Гювеч.бг'),array('http://google.com/', 'Гугъл'));printLinks($arr);
//Примерен изход: <a href="http://abv.bg/">Абв поща</a><a href="http://gbg.bg/">Гювеч.бг</a><a href="http://google.com/">Гугъл</a>
function printLinks($arr)
{
    for ($i = 0; $i < count($arr); $i++) {
        echo '<a href="' . $arr[$i][0] . '">' . $arr[$i][1] . '</a>';
        echo "<br/>";
    }
}
$arr = array(array('http://abv.bg/', 'Абв поща'), array('http://gbg.bg/', 'Гювеч.бг'), array('http://google.com/', 'Гугъл'));
printLinks($arr);
Ejemplo n.º 5
0
        $files_diff[] = $file;
    }
}
// Print output.
print "<link rel='stylesheet' type='text/css' href='./style.css'>";
print "<script src='index.js'></script>";
print "<div class='header'>";
print '<h1>Visual Regression Test Results</h1>';
print "<h3 class='nav-link' id='help'><a href='help.html'>Help</a></h3>";
print "</div>";
print "<div id='menu'>";
printFilters($envs);
print "<div id='file_list'>";
printLinks($files_fail, 'Failed Tests:', 'file_list_fail');
printLinks($files_diff, 'Diffs:', 'file_list_pass');
printLinks($files, 'Baselines:', 'file_list_all');
print "</div>";
print "</div>";
print "<div id='image_diff_wrapper'>";
print "<img id='image_diff'>";
print "</div>";
/**
 * Recursive search for pattern.
 */
function glob_recursive($pattern, $flags = 0)
{
    $files = glob($pattern, $flags);
    foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
        $files = array_merge($files, glob_recursive($dir . '/' . basename($pattern), $flags));
    }
    return $files;
Ejemplo n.º 6
0
function displayColumns($result, $rowsFound, $query, $queryURL, $showQuery, $showLinks, $rowOffset, $showRows, $previousOffset, $nextOffset, $wrapResults, $nothingChecked, $citeStyle, $citeOrder, $headerMsg, $userID, $displayType, $viewType, $addCounterMax, $formType)
{
    global $searchReplaceActionsArray;
    // these variables are defined in 'ini.inc.php'
    global $databaseBaseURL;
    global $defaultDropDownFieldsEveryone;
    global $defaultDropDownFieldsLogin;
    global $displayResultsHeaderDefault;
    global $displayResultsFooterDefault;
    global $showFieldItemLinks;
    global $showLinkTypesInListView;
    global $maximumBrowseLinks;
    global $tableRefs, $tableUserData;
    // defined in 'db.inc.php'
    global $loc;
    // '$loc' is made globally available in 'core.php'
    global $client;
    if (preg_match("/.+LIMIT *[0-9]+/i", $query)) {
        // query does contain the 'LIMIT' parameter
        $orderBy = preg_replace("/.+ORDER BY (.+) LIMIT.+/i", "\\1", $query);
    } else {
        // query does not contain the 'LIMIT' parameter
        $orderBy = preg_replace("/.+ORDER BY (.+)/i", "\\1", $query);
    }
    // extract 'ORDER BY'... parameter
    if ($formType != "queryResults" or $formType == "queryResults" and !$nothingChecked) {
        // If the query has results ...
        if ($rowsFound > 0) {
            // BEGIN RESULTS HEADER --------------------
            // 1) First, initialize some variables that we'll need later on
            if ($showLinks == "1" and $displayType != "Browse") {
                // we exclude the Browse view since it has a special type of 'Links' column and the 'file', 'url', 'doi', 'isbn' & 'type columns weren't included in the query
                $CounterMax = 5;
            } else {
                $CounterMax = 0;
            }
            // Otherwise don't hide any columns
            // count the number of fields
            $fieldsFound = mysql_num_fields($result);
            if ($displayType != "Browse") {
                // hide those last columns that were added by the script and not by the user
                $fieldsToDisplay = $fieldsFound - (2 + $CounterMax + $addCounterMax);
                // (2+$CounterMax) -> $CounterMax is increased by 2 in order to hide the 'orig_record' & 'serial' columns (which were added to make checkboxes & dup warning work)
                // $addCounterMax is set to 1 when the field given in '$fileVisibilityException[0]' (defined in 'ini.inc.php') was added to the query, otherwise '$addCounterMax = 0'
            } else {
                // for Browse view the 'orig_record' & 'serial' columns weren't included in the query
                $fieldsToDisplay = $fieldsFound;
            }
            // Calculate the number of all visible columns (which is needed as colspan value inside some TD tags)
            if ($showLinks == "1") {
                $NoColumns = 1 + $fieldsToDisplay + 1;
            } else {
                $NoColumns = 1 + $fieldsToDisplay;
            }
            // add checkbox column
            // Save the current List view query to a session variable:
            saveSessionVariable("lastListViewQuery", $query);
            // Defines field-specific search & replace 'actions' that will be applied to 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("thesis", "approved", "marked", "copy", "selected", "type"), 'actions' => array("/(.+)/e" => "\$loc['\\1']")), array('fields' => array("type"), 'actions' => array("/(.+)/e" => "\$loc['type\\1']")));
            // NOTE: We substitute contents of the given fields with localized field values from variable
            //       '$loc' (see '$fieldSpecificSearchReplaceActionsArray'). Since the locales in '$loc'
            //       are already HTML encoded, we have to exclude these fields from any further HTML encoding.
            static $encodingExceptionsArray = array("thesis", "approved", "marked", "copy", "selected", "type");
            // 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")) {
                    if ($displayType == "Browse") {
                        $selectedField = preg_replace("/^SELECT (\\w+).*/i", "\\1", $query);
                    } elseif (preg_match("/ WHERE [ ()]*(\\w+)/i", $query)) {
                        // extract the first field from the 'WHERE' clause:
                        $selectedField = preg_replace("/.+ WHERE [ ()]*(\\w+).*/i", "\\1", $query);
                    } else {
                        $selectedField = "author";
                    }
                    // otherwise we'll select the 'author' field by default
                    // Map MySQL field names to localized column names:
                    $fieldNamesArray = mapFieldNames(true);
                    // function 'mapFieldNames()' is defined in 'include.inc.php'
                    $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;
                        }
                    }
                    // 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 (show/hide columns 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, $localizedDropDownFieldsArray, $selectedField, $fieldsToDisplay, $displayType, $headerMsg);
                    echo 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):
                    echo "\n";
                }
                // 3) 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", $displayType, $citeStyle, $citeOrder, $orderBy, $headerMsg, $viewType);
                echo $BrowseLinks;
                // 4) Start a FORM
                if (!preg_match("/^Print\$/i", $viewType) and (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden")) {
                    echo "\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
                }
            }
            // 5) And start a TABLE, with column headers
            echo "\n<table id=\"columns\" class=\"results\" align=\"center\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\" width=\"95%\" summary=\"This table holds the database results for your query\">";
            //    for the column headers, start a TABLE ROW ...
            echo "\n<tr>";
            // ... print a marker ('x') column (which will hold the checkboxes within the results part)
            if (!preg_match("/^(Print|Mobile)\$/i", $viewType) and !preg_match("/^cli/i", $client) and $wrapResults != "0") {
                // Note: we omit the marker column in print/mobile view ('viewType=Print' or 'viewType=Mobile'), for CLI clients, and when outputting only a partial document structure ('wrapResults=0')!
                echo "\n\t<th align=\"left\" valign=\"top\">&nbsp;</th>";
            }
            // for each of the attributes in the result set...
            for ($i = 0; $i < $fieldsToDisplay; $i++) {
                // ... and print out each of the attribute names
                // in that row as a separate TH (Table Header)...
                $HTMLbeforeLink = "\n\t<th align=\"left\" valign=\"top\">";
                // start the table header tag
                $HTMLafterLink = "</th>";
                // close the table header tag
                // call the 'buildFieldNameLinks()' function (defined in 'include.inc.php'), which will return a properly formatted table header tag holding the current field's name
                // as well as the URL encoded query with the appropriate ORDER clause:
                $tableHeaderLink = buildFieldNameLinks("search.php", $query, "", $result, $i, $showQuery, $showLinks, $rowOffset, $showRows, $wrapResults, $citeStyle, $HTMLbeforeLink, $HTMLafterLink, "sqlSearch", $displayType, "", "", $headerMsg, $viewType);
                echo $tableHeaderLink;
                // print the attribute name as link
            }
            if ($showLinks == "1" and $displayType != "Browse") {
                $newORDER = "ORDER BY url DESC, doi DESC";
                // Build the appropriate ORDER BY clause to facilitate sorting by Links column
                $HTMLbeforeLink = "\n\t<th align=\"left\" valign=\"top\">";
                // start the table header tag
                $HTMLafterLink = "</th>";
                // close the table header tag
                // call the 'buildFieldNameLinks()' function (defined in 'include.inc.php'), which will return a properly formatted table header tag holding the current field's name
                // as well as the URL encoded query with the appropriate ORDER clause:
                $tableHeaderLink = buildFieldNameLinks("search.php", $query, $newORDER, $result, $i, $showQuery, $showLinks, $rowOffset, $showRows, $wrapResults, $citeStyle, $HTMLbeforeLink, $HTMLafterLink, "sqlSearch", $displayType, $loc["Links"], "url", $headerMsg, $viewType);
                echo $tableHeaderLink;
                // print the attribute name as link
            } elseif ($showLinks == "1" and $displayType == "Browse") {
                echo "\n\t<th align=\"left\" valign=\"top\">" . "Show" . "</th>";
                // close the table header tag
            }
            // Finish the row
            echo "\n</tr>";
            // END RESULTS HEADER ----------------------
            // BEGIN RESULTS DATA COLUMNS --------------
            // 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++) {
                if (is_integer($rowCounter / 2)) {
                    // if we currently are at an even number of rows
                    $rowClass = "even";
                } else {
                    $rowClass = "odd";
                }
                // ... start a TABLE ROW ...
                echo "\n<tr class=\"" . $rowClass . "\">";
                // ... print a column with a checkbox
                if (!preg_match("/^(Print|Mobile)\$/i", $viewType) and !preg_match("/^cli/i", $client) and $wrapResults != "0") {
                    echo "\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") {
                        echo "\n\t\t<input type=\"checkbox\" onclick=\"updateAllRecs();\" name=\"marked[]\" value=\"";
                        if ($displayType == "Browse") {
                            echo $row[0];
                        } else {
                            echo $row["serial"];
                        }
                        echo "\" title=\"" . $loc["selectRecord"] . "\">";
                    }
                    if (!empty($row["orig_record"])) {
                        if (!isset($displayResultsFooterDefault[$displayType]) or isset($displayResultsFooterDefault[$displayType]) and $displayResultsFooterDefault[$displayType] != "hidden") {
                            echo "\n\t\t<br>";
                        }
                        if ($row["orig_record"] < 0) {
                            echo "\n\t\t<img src=\"img/ok.gif\" alt=\"(" . $loc["original"] . ")\" title=\"" . $loc["originalRecord"] . "\" width=\"14\" height=\"16\" hspace=\"0\" border=\"0\">";
                        } else {
                            // $row["orig_record"] > 0
                            echo "\n\t\t<img src=\"img/caution.gif\" alt=\"(" . $loc["duplicate"] . ")\" title=\"" . $loc["duplicateRecord"] . "\" width=\"5\" height=\"16\" hspace=\"0\" border=\"0\">";
                        }
                    }
                    if ($displayType != "Browse") {
                        // 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
                        echo "\n\t\t<div class=\"unapi\"><abbr class=\"unapi-id\" title=\"" . $databaseBaseURL . "show.php?record=" . $row["serial"] . "\"></abbr></div>";
                    }
                    echo "\n\t</td>";
                }
                // ... and print out each of the attributes
                // in that row as a separate TD (Table Data)
                for ($i = 0; $i < $fieldsToDisplay; $i++) {
                    // fetch the current attribute name:
                    $orig_fieldname = getMySQLFieldInfo($result, $i, "name");
                    // function 'getMySQLFieldInfo()' is defined in 'include.inc.php'
                    if ($displayType == "Browse" and $i == 0) {
                        // in Browse view we save the first field name to yet another variable (since it'll be needed when generating correct queries in the Links column)
                        $browseFieldName = $orig_fieldname;
                    }
                    echo "\n\t<td valign=\"top\">";
                    if (!empty($row[$i])) {
                        // 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
                            // TODO: link somwhere here
                            echo linkifyFieldItems($orig_fieldname, $row[$i], $userID, $fieldSpecificSearchReplaceActionsArray, $encodingExceptionsArray, "/\\s*[;]+\\s*/", "; ", $showQuery, $showLinks, $showRows, $citeStyle, $citeOrder, $wrapResults, $displayType, $viewType);
                        } else {
                            // don't hotlink field items
                            echo encodeField($orig_fieldname, $row[$i], $fieldSpecificSearchReplaceActionsArray, $encodingExceptionsArray);
                        }
                        // function 'encodeField()' is defined in 'include.inc.php'
                    }
                    echo "</td>";
                }
                // embed appropriate links (if available):
                if ($showLinks == "1" and $displayType != "Browse") {
                    echo "\n\t<td valign=\"top\">";
                    // print out available links:
                    // for List view, we'll use the '$showLinkTypesInListView' 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)
                    echo printLinks($showLinkTypesInListView, $row, $showQuery, $showLinks, $wrapResults, $userID, $viewType, $orderBy);
                    echo "\n\t</td>";
                } elseif ($showLinks == "1" and $displayType == "Browse") {
                    // ...extract the 'WHERE' clause from the SQL query to include it within the link URL:
                    $queryWhereClause = extractWHEREclause($query);
                    // function 'extractWHEREclause()' is defined in 'include.inc.php'
                    $queryWhereClause = preg_replace('/^serial RLIKE "\\.\\+"/i', '', $queryWhereClause);
                    // strip generic WHERE clause if present
                    // Construct the SQL query:
                    // TODO: build the complete SQL query using functions 'buildFROMclause()' and 'buildORDERclause()'
                    $browseViewShowRecordsQuery = buildSELECTclause("", $showLinks, "", false, false);
                    // function 'buildSELECTclause()' is defined in 'include.inc.php'
                    $browseViewShowRecordsQuery .= " FROM " . $tableRefs;
                    // add FROM clause
                    if (isset($_SESSION['loginEmail'])) {
                        // if a user is logged in...
                        $browseViewShowRecordsQuery .= " LEFT JOIN " . $tableUserData . " ON serial = record_id AND user_id = " . quote_smart($userID);
                    }
                    // add LEFT JOIN part to FROM clause
                    $browseViewShowRecordsQuery .= " WHERE ";
                    // add WHERE clause
                    if (!empty($queryWhereClause)) {
                        $browseViewShowRecordsQuery .= $queryWhereClause . " AND ";
                    }
                    $browseViewShowRecordsQuery .= $browseFieldName;
                    if (!empty($row[0])) {
                        $browseViewShowRecordsQuery .= " = \"" . $row[0] . "\"";
                    } else {
                        $browseViewShowRecordsQuery .= " IS NULL";
                    }
                    $browseViewShowRecordsQuery .= " ORDER BY author, year DESC, publication";
                    // add the default ORDER BY clause
                    echo "\n\t<td valign=\"top\">";
                    echo "\n\t\t<a href=\"search.php?sqlQuery=" . rawurlencode($browseViewShowRecordsQuery) . "&amp;formType=sqlSearch" . "&amp;showQuery=" . $showQuery . "&amp;showLinks=" . $showLinks . "&amp;showRows=" . $showRows . "&amp;submit=" . "&amp;viewType=" . $viewType . "\"><img src=\"img/details.gif\" alt=\"records\" title=\"show records\" width=\"9\" height=\"17\" hspace=\"0\" border=\"0\"></a>&nbsp;&nbsp;";
                    echo "\n\t</td>";
                }
                // Finish the row
                echo "\n</tr>";
            }
            // Finish the table
            echo "\n</table>";
            // END RESULTS DATA COLUMNS ----------------
            // BEGIN RESULTS FOOTER --------------------
            // Note: we omit the results footer, browse links & query form 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)
                echo $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|allow_export|allow_batch_export/", $_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):
                        echo "\n";
                    }
                    // Call the 'buildResultsFooter()' function (which does the actual work):
                    $ResultsFooter = buildResultsFooter($showRows, $citeStyle, $citeOrder, $displayType, $headerMsg);
                    echo $ResultsFooter;
                }
            }
            // END RESULTS FOOTER ----------------------
            // Finally, finish the form
            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")) {
                echo "\n</form>";
            }
        } else {
            // Report that nothing was found:
            $nothingFoundFeedback = nothingFound(false);
            // This is a clumsy workaround: by pretending that there were some records marked by the user ($nothingChecked = false) we force the 'nothingFound()' function to output "Sorry, but your query didn't produce any results!" instead of "No records selected..."
            echo $nothingFoundFeedback;
        }
        // end if $rowsFound body
    } else {
        // Report that nothing was selected:
        $nothingFoundFeedback = nothingFound($nothingChecked);
        echo $nothingFoundFeedback;
    }
}
Ejemplo n.º 7
0
<p class="result">
	<?php 
if (isset($_POST['links'])) {
    foreach ($_POST['links'] as $key) {
        switch ($key) {
            case 'sports':
                echo '<p>Päivää urheilun ystävä, tässäpä muutama linkki</p>';
                printLinks('sports');
                break;
            case 'music':
                echo '<p>Päivää musiikin ystävä, tässäpä muutama linkki</p>';
                printLinks('music');
                break;
            case 'churches':
                echo '<p>Päivää kirkkojen ystävä, tässäpä muutama linkki</p>';
                printLinks('churches');
                break;
            default:
                break;
        }
    }
}
// just used to populate checkbox after submission
function afterSubmitSet($arrayname, $attrname)
{
    if (isset($_POST[$arrayname]) && in_array($attrname, $_POST[$arrayname])) {
        echo 'selected=true';
    }
}
function printLinks($attrname)
{
<?php

require_once "XrdLinkReader.php";
$xrd = new XrdLinkReader();
echo "<h2>http://gmail.com/.well-known/host-meta</h2>";
printLinks($xrd->getLinksFromUrl("http://gmail.com/.well-known/host-meta"));
echo "<h2>http://www.oexchange.org/demo/linkeater/oexchange.xrd</h2>";
printLinks($xrd->getLinksFromUrl("http://www.oexchange.org/demo/linkeater/oexchange.xrd"));
echo "<h2>http://www.willmeyer.com/.well-known/host-meta</h2>";
printLinks($xrd->getLinksFromUrl("http://www.willmeyer.com/.well-known/host-meta"));
function printLinks($links)
{
    foreach ($links as $link) {
        echo "&nbsp;&nbsp;Link: <br/>";
        foreach ($link as $name => $val) {
            echo "&nbsp;&nbsp;&nbsp;&nbsp;" . $name . ": " . $val . "<br/>";
        }
    }
}
Ejemplo n.º 9
0
/**
* Templates for output
*/
include_once 'templates/userinfo.template.php';
$user = new User($_GET['user']);
$t = new Template(translate('User Info') . ' ' . $user->get_name());
$t->printHTMLHeader();
// Print HTML header
// Make sure this is the admin
if (!Auth::isAdmin()) {
    CmnFns::do_error_box(translate('This is only accessable to the administrator') . '<br />' . '<a href="ctrlpnl.php">' . translate('Back to My Control Panel') . '</a>');
}
if (!$user->is_valid()) {
    // Make sure member ID is valid
    CmnFns::do_error_box(translate('Memberid is not available.', array($user->get_id())));
}
$db = new UserInfoDB();
$prev = $db->get_prev_userid($user);
// Prev memberid
$next = $db->get_next_userid($user);
// Next memberid
$t->startMain();
// Start main table
printUI($user);
// Print user info
printLinks($prev, $next);
// Print links
$t->endMain();
// End main table
$t->printHTMLFooter();
// Print HTML footer
<?php

require_once "WebFingerer.php";
$wf = new Webfingerer();
echo "<h2>getUserXrdUrl</h2>";
echo "will@willmeyer.com<br/>";
echo $wf->getUserXrdUrl("*****@*****.**") . "<br/><br/>";
echo "charlie@ecece.com<br/>";
echo $wf->getUserXrdUrl("*****@*****.**") . "<br/><br/>";
echo "willmeyer@gmail.com<br/>";
echo $wf->getUserXrdUrl("*****@*****.**") . "<br/><br/>";
echo "<h2>getUserLinks</h2>";
echo "will@willmeyer.com<br/>";
echo "<br/>" . printLinks($wf->getUserLinks("*****@*****.**")) . "<br/>";
echo "charlie@ecece.com<br/>";
echo "<br/>" . printLinks($wf->getUserLinks("*****@*****.**")) . "<br/>";
echo "willmeyer@gmail.com<br/>";
echo "<br/>" . printLinks($wf->getUserLinks("*****@*****.**")) . "<br/>";
function printLinks($links)
{
    foreach ($links as $link) {
        echo "&nbsp;&nbsp;Link: <br/>";
        foreach ($link as $name => $val) {
            echo "&nbsp;&nbsp;&nbsp;&nbsp;" . $name . ": " . $val . "<br/>";
        }
    }
}
Ejemplo n.º 11
0
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" => "&#8211;", "emdash" => "&#8212;", "ampersand" => "&", "double-quote" => '"', "double-quote-left" => "&ldquo;", "double-quote-right" => "&rdquo;", "single-quote" => "'", "single-quote-left" => "&lsquo;", "single-quote-right" => "&rsquo;", "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\">" . "&nbsp;|&nbsp;" . $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&nbsp;<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\">" . "&nbsp;|&nbsp;" . $loc["ExportRecord"] . ":";
                            foreach ($userExportFormatsArray as $exportFormat) {
                                $recordData .= "\n\t\t\t\t\t&nbsp;<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;
}