function get_breadcrumbs($db, $query) { if ($query['device'] != null) { $tmp = $query; $tmp['device'] = ''; $out[] = get_device_name($db, $query['device']) . ' [<a href="?' . query_to_string($tmp) . '">x</a>]'; } if ($query['user'] != null) { $tmp = $query; $tmp['user'] = ''; $out[] = get_user_name($db, $query['user']) . ' [<a href="?' . query_to_string($tmp) . '">x</a>]'; } if ($query['begin_date'] != null) { $tmp = $query; $tmp['begin_date'] = ''; $out[] = 'Starting on ' . $query['begin_date'] . ' [<a href="?' . query_to_string($tmp) . '">x</a>]'; } if ($query['end_date'] != null) { $tmp = $query; $tmp['end_date'] = ''; $out[] = 'Ending on ' . $query['end_date'] . ' [<a href="?' . query_to_string($tmp) . '">x</a>]'; } print "Current Filter: " . (count($out) ? implode(' -> ', $out) : 'none'); }
function launch() { global $interface; global $configArray; $interface->setPageTitle('eContent Help'); $defaultFormat = ""; require_once ROOT_DIR . '/sys/eContent/EContentRecord.php'; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; $interface->assign('id', $id); $eContentRecord = new EContentRecord(); $eContentRecord->id = $id; if ($eContentRecord->find(true)) { require_once ROOT_DIR . '/sys/eContent/EContentItem.php'; $eContentItem = new EContentItem(); $eContentItem->id = $_REQUEST['itemId']; if ($eContentItem->find(true)) { $displayFormat = $eContentItem->getDisplayFormat(); $popupContent = "Sorry, there is not detailed help available for this format yet."; if ($eContentItem->item_type == 'mp3') { $defaultFormat = 'mp3'; } else { if ($eContentItem->item_type == 'epub') { $defaultFormat = 'ebook'; } else { if ($eContentItem->item_type == 'kindle') { $defaultFormat = 'kindle'; } else { if ($eContentItem->item_type == 'plucker') { $defaultFormat = 'other'; } else { if ($eContentItem->item_type == 'pdf') { $defaultFormat = 'other'; } else { if ($eContentItem->item_type == 'externalMP3') { $defaultFormat = 'mp3'; } else { if ($eContentItem->item_type == 'external_ebook') { if ($eContentItem->getSource() == 'SpringerLink') { $defaultFormat = 'springerlink'; } elseif (preg_match('/ebsco/i', $eContentItem->getSource())) { $defaultFormat = 'ebsco'; } else { $defaultFormat = 'other'; } } else { if ($eContentItem->item_type == 'externalLink') { $defaultFormat = 'other'; } else { if ($eContentItem->item_type == 'overdrive') { if ($eContentItem->externalFormatId == 'audiobook-mp3') { $defaultFormat = 'mp3'; } else { if ($eContentItem->externalFormatId == 'audiobook-wma') { $defaultFormat = 'wma'; } else { if ($eContentItem->externalFormatId == 'video-wmv') { $defaultFormat = 'eVideo'; } else { if ($eContentItem->externalFormatId == 'music-wma') { $defaultFormat = 'eMusic'; } else { if ($eContentItem->externalFormatId == 'ebook-kindle') { $defaultFormat = 'kindle'; } else { if ($eContentItem->externalFormatId == 'ebook-epub-adobe') { $defaultFormat = 'ebook'; } else { if ($eContentItem->externalFormatId == 'ebook-pdf-adobe') { $defaultFormat = 'other'; } else { if ($eContentItem->externalFormatId == 'ebook-epub-open') { $defaultFormat = 'ebook'; } else { if ($eContentItem->externalFormatId == 'ebook-pdf-open') { $defaultFormat = 'other'; } else { $defaultFormat = 'other'; } } } } } } } } } } else { if ($eContentItem->item_type == 'external_eaudio') { $defaultFormat = 'other'; } else { if ($eContentItem->item_type == 'external_emusic') { $defaultFormat = 'eMusic'; } else { if ($eContentItem->item_type == 'text') { $defaultFormat = 'other'; } else { if ($eContentItem->item_type == 'itunes') { $defaultFormat = 'other'; } else { if ($eContentItem->item_type == 'gifs') { $defaultFormat = 'other'; } else { $defaultFormat = 'other'; } } } } } } } } } } } } } } } } } $interface->assign('defaultFormat', $defaultFormat); $device = get_device_name(); $defaultDevice = ''; if ($device == 'Kindle') { $defaultDevice = 'kindle'; } elseif ($device == 'Kindle Fire') { $defaultDevice = 'kindle_fire'; } elseif ($device == 'iPad' || $device == 'iPhone') { $defaultDevice = 'ios'; } elseif ($device == 'Android Phone' || $device == 'Android Tablet') { $defaultDevice = 'android'; } elseif ($device == 'Android Phone' || $device == 'Android Tablet' || $device == 'Google TV') { $defaultDevice = 'android'; } elseif ($device == 'BlackBerry') { $defaultDevice = 'other'; } elseif ($device == 'Mac') { $defaultDevice = 'mac'; } elseif ($device == 'PC') { $defaultDevice = 'pc'; } $interface->assign('defaultDevice', $defaultDevice); if (isset($_REQUEST['lightbox'])) { $interface->assign('popupTitle', 'Step by Step Instructions for using eContent'); $popupContent = $interface->fetch('Help/eContentHelp.tpl'); $interface->assign('popupContent', $popupContent); $interface->display('popup-wrapper.tpl'); } else { $interface->setTemplate('eContentHelp.tpl'); $interface->display('layout.tpl'); } }
} 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); } } // Process Authentication, must be done here so we can redirect based on user information // immediately after logging in. $interface->assign('loggedIn', $user == false ? 'false' : 'true'); if ($user) { $interface->assign('user', $user); //Create a cookie for the user's home branch so we can sort holdings even if they logout.
function UInterface() { global $configArray; global $timer; $local = $configArray['Site']['local']; $this->vufindTheme = $configArray['Site']['theme']; $isMobile = mobile_device_detect(); // Use mobile theme for mobile devices (if enabled in config.ini) if (isset($configArray['Site']['mobile_theme'])) { // If the user is overriding the UI setting, store that: if (isset($_GET['ui'])) { $_COOKIE['ui'] = $_GET['ui']; setcookie('ui', $_GET['ui'], null, '/'); // If we don't already have a UI setting, detect if we're on a mobile // and store the result in a cookie so we don't waste time doing the // detection routine on every page: } else { if (!isset($_COOKIE['ui'])) { $_COOKIE['ui'] = $isMobile ? 'mobile' : 'standard'; setcookie('ui', $_COOKIE['ui'], null, '/'); } } // If we're mobile, override the standard theme with the mobile one: if ($_COOKIE['ui'] == 'mobile') { //Add library specific themes after the mobile theme so we can get images $this->vufindTheme = $configArray['Site']['mobile_theme'] . "," . $this->vufindTheme; $this->isMobile = true; } } $this->assign('isMobile', $this->isMobile ? 'true' : 'false'); $this->assign('device', get_device_name()); // Check to see if multiple themes were requested; if so, build an array, // otherwise, store a single string. $themeArray = explode(',', $this->vufindTheme); //Make sure we always fall back to the default theme so a template does not have to be overridden. $themeArray[] = 'default'; if (count($themeArray) > 1) { $this->template_dir = array(); foreach ($themeArray as $currentTheme) { $currentTheme = trim($currentTheme); $this->template_dir[] = "{$local}/interface/themes/{$currentTheme}"; } } else { $this->template_dir = "{$local}/interface/themes/{$this->vufindTheme}"; } $this->themes = $themeArray; if (isset($timer)) { $timer->logTime('Set theme'); } // Create an MD5 hash of the theme name -- this will ensure that it's a // writeable directory name (since some config.ini settings may include // problem characters like commas or whitespace). $md5 = md5($this->vufindTheme); $this->compile_dir = "{$local}/interface/compile/{$md5}"; if (!is_dir($this->compile_dir)) { if (!mkdir($this->compile_dir)) { echo "Could not create compile directory {$this->compile_dir}"; die; } } $this->cache_dir = "{$local}/interface/cache/{$md5}"; if (!is_dir($this->cache_dir)) { if (!mkdir($this->cache_dir)) { echo "Could not create cache directory {$this->cache_dir}"; die; } } $this->plugins_dir = array('plugins', "{$local}/interface/plugins"); $this->caching = false; $this->debug = true; $this->compile_check = true; unset($local); $this->register_function('translate', 'translate'); $this->register_function('char', 'char'); $this->assign('site', $configArray['Site']); $this->assign('path', $configArray['Site']['path']); $defaultConfig = $configArray['Site']['path']; $url = $_SERVER['SERVER_NAME']; if (isset($_SERVER['HTTPS'])) { $url = "https://" . $url; } else { $url = "http://" . $url; } if (strlen($configArray['Site']['path']) > 0) { $url .= '/' . $configArray['Site']['path']; } $this->url = $url; $this->assign('template_dir', $this->template_dir); $this->assign('url', $url); $this->assign('coverUrl', $configArray['Site']['coverUrl']); $this->assign('consolidateCss', isset($configArray['Site']['consolidateCss']) ? $configArray['Site']['consolidateCss'] : false); $this->assign('consolidateJs', isset($configArray['Site']['consolidateJs']) ? $configArray['Site']['consolidateJs'] : false); $this->assign('fullPath', str_replace('&', '&', $_SERVER['REQUEST_URI'])); $this->assign('requestHasParams', strpos($_SERVER['REQUEST_URI'], '?') > 0); $this->assign('supportEmail', $configArray['Site']['email']); $this->assign('libraryName', $configArray['Site']['title']); $this->assign('theme', $this->vufindTheme); $this->assign('primaryTheme', reset($themeArray)); $this->assign('device', get_device_name()); $timer->logTime('Basic configuration'); if (isset($configArray['OpenURL']) && isset($configArray['OpenURL']['url'])) { // Trim off any parameters (for legacy compatibility -- default config // used to include extraneous parameters): list($base) = explode('?', $configArray['OpenURL']['url']); } else { $base = false; } $this->assign('openUrlBase', empty($base) ? false : $base); // Other OpenURL settings: $this->assign('openUrlWindow', empty($configArray['OpenURL']['window_settings']) ? false : $configArray['OpenURL']['window_settings']); $this->assign('openUrlGraphic', empty($configArray['OpenURL']['graphic']) ? false : $configArray['OpenURL']['graphic']); $this->assign('openUrlGraphicWidth', empty($configArray['OpenURL']['graphic_width']) ? false : $configArray['OpenURL']['graphic_width']); $this->assign('openUrlGraphicHeight', empty($configArray['OpenURL']['graphic_height']) ? false : $configArray['OpenURL']['graphic_height']); $this->assign('currentTab', 'Search'); $this->assign('authMethod', $configArray['Authentication']['method']); if ($configArray['Authentication']['method'] == 'Shibboleth') { if (!isset($configArray['Shibboleth']['login']) || !isset($configArray['Shibboleth']['target'])) { throw new Exception('Missing parameter in the config.ini. Check if ' . 'the parameters login and target are set.'); } $sessionInitiator = $configArray['Shibboleth']['login'] . '?target=' . $configArray['Shibboleth']['target']; if (isset($configArray['Shibboleth']['provider_id'])) { $sessionInitiator = $sessionInitiator . '&providerId=' . $configArray['Shibboleth']['provider_id']; } $this->assign('sessionInitiator', $sessionInitiator); } }
function UInterface() { global $configArray; global $timer; $local = $configArray['Site']['local']; $this->vufindTheme = $configArray['Site']['theme']; $this->isMobile = mobile_device_detect(); $this->assign('isMobile', $this->isMobile ? 'true' : 'false'); $this->assign('device', get_device_name()); //Figure out google translate id if (isset($configArray['Translation']['google_translate_key']) && strlen($configArray['Translation']['google_translate_key']) > 0) { $this->assign('google_translate_key', $configArray['Translation']['google_translate_key']); $this->assign('google_included_languages', $configArray['Translation']['includedLanguages']); } $thisYear = new Date(); $this->assign('lastYear', $thisYear->getYear() - 1); if (isset($_REQUEST['print'])) { $this->assign('print', true); } // Check to see if multiple themes were requested; if so, build an array, // otherwise, store a single string. $themeArray = explode(',', $this->vufindTheme); //Make sure we always fall back to the default theme so a template does not have to be overridden. $themeArray[] = 'default'; if (count($themeArray) > 1) { $this->template_dir = array(); foreach ($themeArray as $currentTheme) { $currentTheme = trim($currentTheme); $this->template_dir[] = "{$local}/interface/themes/{$currentTheme}"; } } else { $this->template_dir = "{$local}/interface/themes/{$this->vufindTheme}"; } $this->themes = $themeArray; if (isset($timer)) { $timer->logTime('Set theme'); } // Create an MD5 hash of the theme name -- this will ensure that it's a // writeable directory name (since some config.ini settings may include // problem characters like commas or whitespace). $md5 = md5($this->vufindTheme); $this->compile_dir = "{$local}/interface/compile/{$md5}"; if (!is_dir($this->compile_dir)) { if (!mkdir($this->compile_dir)) { echo "Could not create compile directory {$this->compile_dir}"; die; } } $this->cache_dir = "{$local}/interface/cache/{$md5}"; if (!is_dir($this->cache_dir)) { if (!mkdir($this->cache_dir)) { echo "Could not create cache directory {$this->cache_dir}"; die; } } $this->plugins_dir = array('plugins', "{$local}/interface/plugins"); $this->caching = false; $this->debug = true; $this->compile_check = true; unset($local); $this->register_block('display_if_inconsistent', 'display_if_inconsistent'); $this->register_block('display_if_set', 'display_if_set'); $this->register_function('translate', 'translate'); $this->register_function('char', 'char'); $this->assign('site', $configArray['Site']); $this->assign('path', $configArray['Site']['path']); $defaultConfig = $configArray['Site']['path']; $url = $_SERVER['SERVER_NAME']; if (isset($_SERVER['HTTPS'])) { $url = "https://" . $url; } else { $url = "http://" . $url; } if (strlen($configArray['Site']['path']) > 0) { $url .= '/' . $configArray['Site']['path']; } $this->url = $url; $this->assign('template_dir', $this->template_dir); $this->assign('url', $url); $this->assign('coverUrl', $configArray['Site']['coverUrl']); $this->assign('fullPath', str_replace('&', '&', $_SERVER['REQUEST_URI'])); $this->assign('requestHasParams', strpos($_SERVER['REQUEST_URI'], '?') > 0); if (isset($configArray['Site']['email'])) { $this->assign('supportEmail', $configArray['Site']['email']); } if (isset($configArray['Site']['libraryName'])) { $this->assign('consortiumName', $configArray['Site']['libraryName']); } $this->assign('libraryName', $configArray['Site']['title']); $this->assign('ils', $configArray['Catalog']['ils']); if (isset($configArray['Catalog']['url'])) { $this->assign('classicCatalogUrl', $configArray['Catalog']['url']); } else { if (isset($configArray['Catalog']['hipUrl'])) { $this->assign('classicCatalogUrl', $configArray['Catalog']['hipUrl']); } } $this->assign('showConvertListsFromClassic', $configArray['Catalog']['showConvertListsFromClassic']); $this->assign('theme', $this->vufindTheme); $this->assign('primaryTheme', reset($themeArray)); $this->assign('device', get_device_name()); $timer->logTime('Basic configuration'); $this->assign('currentTab', 'Search'); $this->assign('authMethod', $configArray['Authentication']['method']); if ($configArray['System']['debug']) { $this->assign('debug', true); } if ($configArray['System']['debugJs']) { $this->assign('debugJs', true); } if (isset($configArray['System']['debugCss']) && $configArray['System']['debugCss']) { $this->assign('debugCss', true); } // Detect Internet Explorer 8 to include respond.js for responsive css support if (isset($_SERVER['HTTP_USER_AGENT'])) { $ie8 = stristr($_SERVER['HTTP_USER_AGENT'], 'msie 8') || stristr($_SERVER['HTTP_USER_AGENT'], 'trident/5'); //trident/5 should catch ie9 compability modes $this->assign('ie8', $ie8); } $session = new Session(); $session->session_id = session_id(); if ($session->find(true)) { $this->assign('session', session_id() . ', remember me ' . $session->remember_me); } else { $this->assign('session', session_id() . ' - not saved'); } }
function get_browser_cached($useragent) { $digest = md5($useragent); $browser_file = browser_file($digest); if (file_exists($browser_file)) { $saved = unserialize(file_get_contents($browser_file)); } else { $browser_o = get_browser($useragent); $device_name = get_device_name($useragent); $saved = ['get_browser' => $browser_o, 'get_device_name' => $device_name]; file_put_contents($browser_file, serialize($saved)); } return [$saved['get_browser'], $saved['get_device_name']]; }
"filename":"'.get_filename($hardware_board, $device_name, $current_version).'", "filesize":"'.get_new_filesize($hardware_board, $device_name, $current_version).'", "mod":"'.$device_name.'", "version": "'.$current_version.'", "branch": "'.get_branch($hardware_board, $device_name, $current_version).'" } ], "IncrementalUpdateList": [ { "type":"rom", "board":"'.$hardware_board.'", "name":"'.get_device_name($hardware_board, $device_name, $new_version).' OTA from: '.$current_version.'", "acknowledgementUrl":"", "acknowledgementUrl": "http://miuiandroid.com/ota/'.$new_ver.'_ack.html", "descriptionUrl": "http://miuiandroid.com/ota/'.$new_ver.'_desc.html", "description":"MIUIAndroid '.get_device_name($hardware_board, $device_name, $new_version).' ROM '.$new_version.'", "checksum":"'.get_new_checksum($hardware_board, $device_name, $new_version).'", "filename":"'.get_new_filename($hardware_board, $device_name, $new_version).'", "filesize":"'.get_new_filesize($hardware_board, $device_name, $new_version).'", "mod":"'.$device_name.'", "version":"'.substr($new_version, 5).'", "versionForApply":"'.substr($current_version, 5).'", "branch":"X" } ], "MirrorList": [ "http://miuiandroid.com/ota/" ], "Signup": { "version": "'.$new_version.'", "total": "",
function get_device_mem($useragent) { $digest = md5($useragent); $mem = api_open_mmc(); if ($device_name = $mem->ns_get(GET_DEVICE, $digest)) { return $device_name; } $device_name = get_device_name($useragent); $mem->ns_set(GET_DEVICE, $digest, $device_name, GET_DEVICE_EXPIRE); return $device_name; }