/** * Constructor * * @access public */ public function __construct() { global $interface; // Don't allow crawling of MetaLib results at all $this->disallowBots(); if (!$interface->get_template_vars('metalibEnabled')) { PEAR::raiseError(new PEAR_Error("MetaLib is not enabled.")); } $interface->assign('currentTab', 'MetaLib'); // Send MetaLib search types to the template so the basic search box can // function on all pages of the MetaLib. $this->searchObject = SearchObjectFactory::initSearchObject('MetaLib'); $sets = $this->searchObject->getSearchSets(); if (isset($_REQUEST['set']) && strncmp($_REQUEST['set'], '_ird:', 5) == 0) { $set = $_REQUEST['set']; $ird = substr($set, 5); if (preg_match('/\\W/', $ird)) { PEAR::raiseError(new PEAR_Error('Invalid parameter')); } $irdInfo = $this->searchObject->getIRDInfo($ird); if ($irdInfo === false) { PEAR::raiseError(new PEAR_Error('Invalid parameter')); } // Append to recently used search sets and select as active unset($_SESSION['recentMetaLibDatabases'][$set]); $_SESSION['recentMetaLibDatabases'][$set] = $irdInfo['name']; $interface->assign('searchSet', "_ird:{$ird}"); } else { // Select first set by default $interface->assign('searchSet', current(array_keys($sets))); } if ($this->isBrowseEnabled()) { include_once 'services/Browse/Database.php'; $action = new Database(); $interface->assign('browseDatabases', $action->getBrowseUrl('Database')); } $interface->assign('metalibSearchTypes', $this->searchObject->getBasicTypes()); $interface->assign('metalibSearchSets', $sets); $interface->assign('metalibRecentDatabases', $this->searchObject->getRecentDatabases()); // Increase max execution time to allow slow MetaLib searches to complete set_time_limit(60); }