Esempio n. 1
0
//Look for spammy searches
if (isset($_REQUEST['lookfor'])) {
    $searchTerm = $_REQUEST['lookfor'];
    if (preg_match('/http:|mailto:|https:/i', $searchTerm)) {
        PEAR_Singleton::raiseError("Sorry it looks like you are searching for a website, please rephrase your query.");
        $_REQUEST['lookfor'] = '';
        $_GET['lookfor'] = '';
    }
    if (strlen($searchTerm) >= 256) {
        PEAR_Singleton::raiseError("Sorry your query is too long, please rephrase your query.");
        $_REQUEST['lookfor'] = '';
        $_GET['lookfor'] = '';
    }
}
if (!$analytics->isTrackingDisabled()) {
    $analytics->setModule($module);
    $analytics->setAction($action);
    $analytics->setObjectId(isset($_REQUEST['id']) ? $_REQUEST['id'] : null);
    $analytics->setMethod(isset($_REQUEST['method']) ? $_REQUEST['method'] : null);
    $analytics->setLanguage($interface->getLanguage());
    $analytics->setTheme($interface->getPrimaryTheme());
    $analytics->setMobile($interface->isMobile() ? 1 : 0);
    $analytics->setDevice(get_device_name());
    $analytics->setPhysicalLocation($physicalLocation);
    if ($user) {
        $analytics->setPatronType($user->patronType);
        $analytics->setHomeLocationId($user->homeLocationId);
    } else {
        $analytics->setPatronType('logged out');
        $analytics->setHomeLocationId(-1);
    }