Created
December 28, 2010 20:33
-
-
Save dmolsen/757673 to your computer and use it in GitHub Desktop.
The main file for the federated search feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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