Skip to content

Instantly share code, notes, and snippets.

@dmolsen
Created December 28, 2010 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmolsen/757673 to your computer and use it in GitHub Desktop.
Save dmolsen/757673 to your computer and use it in GitHub Desktop.
The main file for the federated search feature
<?php
/**
* Copyright (c) 2010 West Virginia University
*
* Licensed under the MIT License
* Redistributions of files must retain the above copyright notice.
*
*/
// various copy includes
require_once "../../config.gen.inc.php";
// records stats
require_once "../page_builder/page_header.php";
// require libs
require_once "../../lib/spyc-0.4.5/spyc.php";
$filter = $_REQUEST['filter'];
$html = '';
if ($filter != '') {
$base_dir = getcwd()."/../";
$files = scandir($base_dir);
// look through all the directories to see which ones have the info.yml file
// when found look to see if the option 'federated' is set to true.
// then attempt to include the federated.php script to search that module & return results
foreach ($files as $file) {
if (is_dir($base_dir.$file)) {
$config_file = $base_dir.$file."/info.yml";
if (file_exists($config_file)) {
$config = Spyc::YAMLLoad($config_file);
if ($config["federated"] == true) {
$filepath = $base_dir.$file."/federated.php";
if (file_exists($filepath)) {
include($filepath);
}
}
}
}
}
}
require "templates/$prefix/index.html";
$page->output();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment