本文整理汇总了PHP中detect_browser函数的典型用法代码示例。如果您正苦于以下问题:PHP detect_browser函数的具体用法?PHP detect_browser怎么用?PHP detect_browser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了detect_browser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_authlog
/**
* Display authentication log.
*
* @param array $vars
* @return none
*
*/
function print_authlog($vars)
{
$authlog = get_authlog_array($vars);
if (!$authlog['count']) {
// There have been no entries returned. Print the warning. Shouldn't happen, how did you get here without auth?!
print_warning('<h4>No authentication entries found!</h4>');
} else {
$string = generate_box_open($vars['header']);
// Entries have been returned. Print the table.
$string .= '<table class="' . OBS_CLASS_TABLE_STRIPED_MORE . '">' . PHP_EOL;
$cols = array('date' => array('Date', 'style="width: 150px;"'), 'user' => 'User', 'from' => 'From', 'ua' => array('User-Agent', 'style="width: 200px;"'), 'NONE' => 'Action');
if ($vars['page'] == 'preferences') {
unset($cols['user']);
}
$string .= get_table_header($cols);
//, $vars); // Currently sorting is not available
$string .= '<tbody>' . PHP_EOL;
foreach ($authlog['entries'] as $entry) {
if (strlen($entry['user_agent']) > 1) {
$entry['detect_browser'] = detect_browser($entry['user_agent']);
//r($entry['detect_browser']);
$entry['user_agent'] = '<i class="' . $entry['detect_browser']['icon'] . '"></i> ' . $entry['detect_browser']['browser_full'];
if ($entry['detect_browser']['platform']) {
$entry['user_agent'] .= ' (' . $entry['detect_browser']['platform'] . ')';
}
}
if (strstr(strtolower($entry['result']), 'fail', true)) {
$class = " class=\"error\"";
} else {
$class = "";
}
$string .= '
<tr' . $class . '>
<td>' . $entry['datetime'] . '</td>';
if (isset($cols['user'])) {
$string .= '
<td>' . escape_html($entry['user']) . '</td>';
}
$string .= '
<td>' . ($_SESSION['userlevel'] > 5 ? generate_popup_link('ip', $entry['address']) : preg_replace('/^\\d+/', '*', $entry['address'])) . '</td>
<td>' . $entry['user_agent'] . '</td>
<td>' . $entry['result'] . '</td>
</tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
$string .= generate_box_close();
// Add pagination header
if ($authlog['pagination_html']) {
$string = $authlog['pagination_html'] . $string . $authlog['pagination_html'];
}
// Print authlog
echo $string;
}
}
示例2: print_authlog
/**
* Display authentication log.
*
* @param array $vars
* @return none
*
*/
function print_authlog($vars)
{
$authlog = get_authlog_array($vars);
if (!$authlog['count']) {
// There have been no entries returned. Print the warning. Shouldn't happen, how did you get here without auth?!
print_warning('<h4>没有发现任何认证项目!</h4>');
} else {
// Entries have been returned. Print the table.
$string = '<table class="table table-bordered table-striped table-hover table-condensed table-rounded">' . PHP_EOL;
$cols = array('date' => array('Date', 'style="width: 200px;"'), 'user' => '用户', 'from' => 'From', 'ua' => array('User-Agent', 'style="width: 200px;"'), 'NONE' => 'Action');
$string .= get_table_header($cols);
//, $vars); // Currently sorting is not available
$string .= '<tbody>' . PHP_EOL;
foreach ($authlog['entries'] as $entry) {
if (strlen($entry['user_agent']) > 1) {
$entry['detect_browser'] = detect_browser($entry['user_agent'], TRUE);
$entry['user_agent'] = $entry['detect_browser']['browser'];
if ($entry['detect_browser']['platform']) {
$entry['user_agent'] .= ' (' . $entry['detect_browser']['platform'] . ')';
}
}
if (strstr(strtolower($entry['result']), 'fail', true)) {
$class = " class=\"error\"";
} else {
$class = "";
}
$string .= '
<tr' . $class . '>
<td>' . $entry['datetime'] . '</td>
<td>' . escape_html($entry['user']) . '</td>
<td>' . $entry['address'] . '</td>
<td>' . $entry['user_agent'] . '</td>
<td>' . $entry['result'] . '</td>
</tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
// Add pagination header
if ($authlog['pagination_html']) {
$string = $authlog['pagination_html'] . $string . $authlog['pagination_html'];
}
// Print authlog
echo $string;
}
}
示例3: filetypes
$GO_SECURITY->authenticate();
$GO_MODULES->authenticate('email');
require $GO_CONFIG->class_path . "imap.class.inc";
require $GO_MODULES->class_path . "email.class.inc";
require $GO_CONFIG->class_path . 'filetypes.class.inc';
$filetypes = new filetypes();
$mail = new imap();
$email = new email();
$account = $email->get_account($_REQUEST['account_id']);
if ($mail->open($account['host'], $account['type'], $account['port'], $account['username'], $GO_CRYPTO->decrypt($account['password']), $_REQUEST['mailbox'], 0, $account['use_ssl'], $account['novalidate_cert'])) {
$file = $mail->view_part($_REQUEST['uid'], $_REQUEST['part'], $_REQUEST['transfer'], $_REQUEST['mime']);
$mail->close();
$filename = smartstrip($_REQUEST['filename']);
$extension = get_extension($filename);
$type = $filetypes->get_type($extension);
$browser = detect_browser();
//header('Content-Length: '.strlen($file));
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if ($browser['name'] == 'MSIE') {
header('Content-Type: application/download');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Type: ' . $type['mime']);
header('Pragma: no-cache');
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
header('Content-Transfer-Encoding: binary');
echo $file;
} else {
示例4: db_connect
<?php
// inc_logger HTML include for use in dynamic websites
//
// Version 0.3 16 October 2001 - Philip Lee
// Determine browser
include "{$site_root}/libs/lib_browser.php";
// Get connection to database
$link_id = db_connect();
// Get browser information
$browser = detect_browser($link_id);
// Create the SQL query string
$sql = "INSERT DELAYED INTO logging_log " . "(day,hour,session_id,site_id,user_id,browser,ver,platform,time,page,ip_address,remote_host,referrer,exit_page) " . "VALUES (" . date('Ymd', mktime()) . ",'" . date('H', mktime()) . "','" . $PHPSESSID . "','" . $site_id . "','" . $user_id . "','" . $browser[1] . "','" . $browser[2] . "','" . $browser[0] . "','" . time() . "','" . $PHP_SELF . "','" . $REMOTE_ADDR . "','" . $REMOTE_HOST . "','" . $HTTP_REFERER . "','" . $exit_page . "'" . ");";
// Insert into database
$res_logger = mysql_query($sql, $link_id);
if (!$res_logger) {
echo "Logging insert failed";
}
示例5: platform_launch_ip_authorization_checks
/**
* platform_launch_ip_authorization_checks: used for IP authorizations
* @param void
*
* @return void
*/
function platform_launch_ip_authorization_checks()
{
platform_launch_php('global');
$ip = network_get_real_ip();
$browser = detect_browser();
switch ($ip) {
// allowed ip addresses
// from localhost
case '127.0.0.1':
case '127.0.1.1':
// from starbright
//case '10.10.50.121':
// from starbright
//case '10.10.50.121':
case '10.10.50.192':
case '10.10.50.193':
// from ehonet
// from ehonet
case '192.168.43.1':
case '192.168.43.2':
case '192.168.43.42':
case '192.168.43.65':
case '192.168.43.174':
// from ehonet-wifi
// from ehonet-wifi
case '10.10.2.200':
case '10.10.2.210':
case '10.10.2.220':
case '10.10.2.222':
case '10.10.2.225':
case '10.10.2.230':
case '10.10.2.240':
//redirect_to('http://'.$_SERVER['HTTP_HOST'].'/platform/');
break;
default:
redirect_to('http://www.entilda.com?api=' . base64_encode(base64_encode(base64_encode(time()))) . '&encdata=true&tracking=enabled&cryptocheck=' . base64_encode(base64_encode(base64_encode($ip))) . '&detected=' . $ip . '&client=' . $browser);
break;
}
}
示例6: generate_graph_tag
function generate_graph_tag($args)
{
if (empty($args)) {
return '';
}
// Quick return if passed empty array
$style = 'max-width: 100%; width: auto; vertical-align: top;';
if (isset($args['style'])) {
if (is_array($args['style'])) {
$style .= implode("; ", $args['style']) . ';';
} else {
$style .= $args['style'] . ';';
}
unset($args['style']);
}
// Detect allowed screen ratio for current browser
$ua_info = detect_browser();
$zoom = $ua_info['screen_ratio'];
if ($zoom >= 2) {
// Add img srcset for HiDPI screens
$args_x = $args;
$args_x['zoom'] = $zoom;
$srcset = ' srcset="' . generate_graph_url($args_x) . ' ' . $args_x['zoom'] . 'x"';
} else {
$srcset = '';
}
return '<img src="' . generate_graph_url($args) . '"' . $srcset . ' style="' . $style . '" alt="" />';
}
示例7: browser_info
function browser_info()
{
backtrace(detect_browser(), 'p', 'Browser');
}
示例8: overlib_link
function overlib_link($url, $text, $contents, $class = NULL, $escape = FALSE)
{
global $config, $link_iter;
$link_iter++;
if ($escape) {
$text = escape_html($text);
}
// Allow the Grinch to disable popups and destroy Christmas.
if ($config['web_mouseover'] && detect_browser() != 'mobile') {
$output = '<a href="' . $url . '" class="tooltip-from-data ' . $class . '" data-tooltip="' . escape_html($contents) . '">' . $text . '</a>';
} else {
$output = '<a href="' . $url . '" class="' . $class . '">' . $text . '</a>';
}
return $output;
}
示例9: get_device_icon
/**
* Returns icon tag (by default) or icon name for current device array
*
* @param array $device Array with device info (from DB)
* @param bool $base_icon Return complete img tag with icon (by default) or just base icon name
*
* @return string Img tag with icon or base icon name
*/
function get_device_icon($device, $base_icon = FALSE)
{
global $config;
$icon = 'generic';
$device['os'] = strtolower($device['os']);
$model = $config['os'][$device['os']]['model'];
if ($device['icon'] && is_file($config['html_dir'] . '/images/os/' . $device['icon'] . '.png')) {
// Custom device icon from DB
$icon = $device['icon'];
} else {
if ($model && isset($config['model'][$model][$device['sysObjectID']]['icon']) && is_file($config['html_dir'] . '/images/os/' . $config['model'][$model][$device['sysObjectID']]['icon'] . '.png')) {
// Per model icon
$icon = $config['model'][$model][$device['sysObjectID']]['icon'];
} else {
if ($config['os'][$device['os']]['icon'] && is_file($config['html_dir'] . '/images/os/' . $config['os'][$device['os']]['icon'] . '.png')) {
// Icon defined in os definition
$icon = $config['os'][$device['os']]['icon'];
} else {
if ($device['distro']) {
// Icon by distro name
$distro = safename(strtolower(trim($device['distro'])));
if (is_file($config['html_dir'] . '/images/os/' . $distro . '.png')) {
$icon = $distro;
}
}
if ($icon == 'generic' && is_file($config['html_dir'] . '/images/os/' . $device['os'] . '.png')) {
// Icon by OS name
$icon = $device['os'];
}
}
}
}
if ($icon == 'generic' && $config['os'][$device['os']]['vendor']) {
// Icon by vendor name
$vendor = safename(strtolower(trim($config['os'][$device['os']]['vendor'])));
if (is_file($config['html_dir'] . '/images/os/' . $vendor . '.png')) {
$icon = $vendor;
}
}
if ($base_icon) {
// return base name for os icon
return $icon;
} else {
// return image html tag
$srcset = '';
if (is_file($config['html_dir'] . '/images/os/' . $icon . '_2x.png')) {
// Detect allowed screen ratio for current browser
$ua_info = detect_browser();
if ($ua_info['screen_ratio'] > 1) {
$srcset = ' srcset="' . $config['base_url'] . '/images/os/' . $icon . '_2x.png' . ' 2x"';
}
}
// Image tag -- FIXME re-engineer this code to do this properly. This is messy.
$image = '<img src="' . $config['base_url'] . '/images/os/' . $icon . '.png"' . $srcset . ' alt="" />';
return $image;
}
}
示例10: print_navbar
/**
* Generate Bootstrap-format navigation bar
*
* A little messy, but it works and lets us move to having no navbar markup on pages :)
* Examples:
* print_navbar(array('brand' => "Apps", 'class' => "navbar-narrow", 'options' => array('mysql' => array('text' => "MySQL", 'url' => generate_url($vars, 'app' => "mysql")))))
*
* @param array $vars
* @return none
*
*/
function print_navbar($navbar)
{
global $config;
if (OBSERVIUM_EDITION == 'community' && isset($navbar['community']) && $navbar['community'] === FALSE) {
// Skip nonexistant features on community edition
return;
}
$id = strgen();
// Detect allowed screen ratio for current browser, cached!
$ua_info = detect_browser();
?>
<div class="navbar <?php
echo $navbar['class'];
?>
" style="<?php
echo $navbar['style'];
?>
">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target="#nav-<?php
echo $id;
?>
">
<span class="oicon-bar"></span>
</button>
<?php
if (isset($navbar['brand'])) {
echo ' <a class="brand">' . $navbar['brand'] . '</a>';
}
echo '<div class="nav-collapse" id="nav-' . $id . '">';
//rewrite navbar (for class pull-right)
$newbar = array();
foreach (array('options', 'options_right') as $array_name) {
if (isset($navbar[$array_name])) {
foreach ($navbar[$array_name] as $option => $array) {
if (isset($array['userlevel']) && isset($_SESSION['userlevel']) && $_SESSION['userlevel'] < $array['userlevel']) {
// skip not permitted menu items
continue;
}
if (OBSERVIUM_EDITION == 'community' && isset($array['community']) && $array['community'] === FALSE) {
// Skip not exist features on community
continue;
}
if (strstr($array['class'], 'pull-right') || $array_name == 'options_right' || $array['right'] == TRUE) {
$array['class'] = str_replace('pull-right', '', $array['class']);
$newbar['options_right'][$option] = $array;
} else {
$newbar['options'][$option] = $array;
}
}
}
}
foreach (array('options', 'options_right') as $array_name) {
if ($array_name == 'options_right') {
if (!$newbar[$array_name]) {
break;
}
echo '<ul class="nav pull-right">';
} else {
echo '<ul class="nav">';
}
foreach ($newbar[$array_name] as $option => $array) {
// if($array['divider']) { echo '<li class="divider"></li>'; break;}
if (!is_array($array['suboptions'])) {
echo '<li class="' . $array['class'] . '">';
$link_opts = '';
if (isset($array['link_opts'])) {
$link_opts .= ' ' . $array['link_opts'];
}
if (isset($array['alt'])) {
$link_opts .= ' data-rel="tooltip" data-tooltip="' . $array['alt'] . '"';
}
if (isset($array['id'])) {
$link_opts .= ' id="' . $array['id'] . '"';
}
if (empty($array['url']) || $array['url'] == '#') {
$array['url'] = 'javascript:void(0)';
}
echo '<a href="' . $array['url'] . '" ' . $link_opts . '>';
if (isset($array['icon'])) {
echo '<i class="' . $array['icon'] . '"></i> ';
$array['text'] = '<span>' . $array['text'] . '</span>';
// Added span for allow hide by class 'icon'
}
if (isset($array['image'])) {
if (isset($array['image_2x']) && $ua_info['screen_ratio'] > 1) {
//.........这里部分代码省略.........
示例11: array
echo "</table><BR>";
if ($fred[0] != 'unknown' && $fred[1] != 'unknown' && $fred[2] != 'unknown') {
$pass++;
}
}
echo "Total tests: {$total}<BR>";
echo "Passed tests: {$pass}<BR><BR>";
// Define WebTV browsers
echo "Setting up list of Netbox browsers<BR>";
$netbox = array("[Mozilla/3.01 (compatible; Netbox/3.5 R93rc3; Linux 2.2)]");
$total = count($netbox);
$pass = 0;
echo "<hr>";
echo "<h2>Netbox Tests</h2>";
foreach ($netbox as $key => $value) {
$fred = detect_browser($link_id, $netbox[$key]);
echo "<table width='100%' cellpadding='0' cellspacing='0' border='1'>";
echo "<tr colspan='3'>";
echo "<td>{$netbox[$key]}</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='50%'>{$fred['1']}</td><td width='25%'>{$fred['2']}</td><td width='25%'>{$fred['0']}</td>";
echo "</tr>";
echo "</tr>";
echo "</table><BR>";
if ($fred[0] != 'unknown' && $fred[1] != 'unknown' && $fred[2] != 'unknown') {
$pass++;
}
}
echo "Total tests: {$total}<BR>";
echo "Passed tests: {$pass}<BR><BR>";
示例12: journal_connexions
//.........这里部分代码省略.........
}
}
}
$alt = $alt * -1;
echo "<tr class='lig{$alt} white_hover'>\n";
echo "<td class=\"col\">" . $temp1 . $date_debut . $temp2 . "</td>\n";
if ($row[4] == 4) {
echo "<td class=\"col\">" . $temp1 . $date_fin . "<br />Tentative de connexion<br />avec mot de passe erroné." . $temp2 . "</td>\n";
} else {
echo "<td class=\"col\">" . $temp1 . $date_fin . $temp2 . "</td>\n";
}
if (!isset($active_hostbyaddr) or $active_hostbyaddr == "all") {
//$result_hostbyaddr = " - ".@gethostbyaddr($row[2]);
if (!in_array($row[2], $tab_host)) {
$tab_host[$row[2]] = @gethostbyaddr($row[2]);
}
$result_hostbyaddr = " - " . $tab_host[$row[2]];
} else {
if ($active_hostbyaddr == "no_local") {
if (mb_substr($row[2], 0, 3) == 127 or mb_substr($row[2], 0, 3) == 10.0 or mb_substr($row[2], 0, 7) == 192.168) {
$result_hostbyaddr = "";
} else {
$tabip = explode(".", $row[2]);
if ($tabip[0] == 172 && $tabip[1] >= 16 && $tabip[1] <= 31) {
$result_hostbyaddr = "";
} else {
//$result_hostbyaddr = " - ".@gethostbyaddr($row[2]);
if (!in_array($row[2], $tab_host)) {
$tab_host[$row[2]] = @gethostbyaddr($row[2]);
}
$result_hostbyaddr = " - " . $tab_host[$row[2]];
}
}
} else {
$result_hostbyaddr = "";
}
}
echo "<td class=\"col\"><span class='small'>" . $temp1 . $row[2] . $result_hostbyaddr . $temp2 . "</span></td>\n";
//echo "<td class=\"col\">".$temp1. detect_browser($row[3]) .$temp2. "</td>\n";
if (!in_array($row[3], $tab_browser)) {
$tab_browser[$row[3]] = detect_browser($row[3]);
}
echo "<td class=\"col\">" . $temp1 . $tab_browser[$row[3]] . $temp2 . "</td>\n";
echo "</tr>\n";
flush();
}
}
echo "</table>\n";
echo "<form action=\"" . $_SERVER['PHP_SELF'] . "#connexion\" name=\"form_affiche_log\" method=\"post\">\n";
if ($page == 'modify_user') {
echo "<input type='hidden' name='user_login' value='{$login}' />\n";
echo "<input type='hidden' name='journal_connexions' value='y' />\n";
} elseif ($page == 'modify_eleve') {
echo "<input type='hidden' name='eleve_login' value='{$login}' />\n";
echo "<input type='hidden' name='journal_connexions' value='y' />\n";
} elseif ($page == 'modify_resp') {
echo "<input type='hidden' name='pers_id' value='{$pers_id}' />\n";
echo "<input type='hidden' name='journal_connexions' value='y' />\n";
}
echo "Afficher le journal des connexions depuis : <select name=\"duree\" size=\"1\">\n";
echo "<option ";
if ($duree == 7) {
echo "selected";
}
echo " value=7>Une semaine</option>\n";
echo "<option ";
if ($duree == 15) {
echo "selected";
}
echo " value=15 >Quinze jours</option>\n";
echo "<option ";
if ($duree == 30) {
echo "selected";
}
echo " value=30>Un mois</option>\n";
echo "<option ";
if ($duree == 60) {
echo "selected";
}
echo " value=60>Deux mois</option>\n";
echo "<option ";
if ($duree == 183) {
echo "selected";
}
echo " value=183>Six mois</option>\n";
echo "<option ";
if ($duree == 365) {
echo "selected";
}
echo " value=365>Un an</option>\n";
echo "<option ";
if ($duree == 'all') {
echo "selected";
}
echo " value='all'>Le début</option>\n";
echo "</select>\n";
echo "<input type=\"submit\" name=\"Valider\" value=\"Valider\" />\n";
echo "</form>\n";
echo "<p class='small'>** Les renseignements ci-dessus peuvent vous permettre de vérifier qu'une connexion pirate n'a pas été effectuée sur votre compte.\n\tDans le cas d'une connexion inexpliquée, vous devez immédiatement en avertir l'<a href=\"mailto:" . getSettingValue("gepiAdminAdress") . "\">administrateur</a>.</p>\n";
}
示例13: is_safari
function is_safari()
{
return detect_browser('safari');
}
示例14: navbar_entry
function navbar_entry($entry, $level = 1)
{
global $cache;
if ($entry['divider']) {
echo str_pad('', ($level - 1) * 2) . ' <li class="divider"></li>' . PHP_EOL;
} elseif ($entry['locations']) {
// Workaround until the menu builder returns an array instead of echo()
echo str_pad('', ($level - 1) * 2) . ' <li class="dropdown-submenu">' . PHP_EOL;
echo str_pad('', ($level - 1) * 2) . ' ' . generate_menu_link(generate_url(array('page' => 'locations')), '<i class="menu-icon oicon-building-hedge"></i> Locations') . PHP_EOL;
navbar_location_menu($cache['locations']);
echo str_pad('', ($level - 1) * 2) . ' </li>' . PHP_EOL;
} else {
$entry_text = '<i class="menu-icon ' . $entry['icon'] . '"></i> ';
if (isset($entry['image'])) {
// Detect allowed screen ratio for current browser, cached!
$ua_info = detect_browser();
if (isset($entry['image_2x']) && $ua_info['screen_ratio'] > 1) {
// Add hidpi image set
$srcset = ' srcset="' . $entry['image_2x'] . ' 2x"';
} else {
$srcset = '';
}
$entry_text .= '<img src="' . $entry['image'] . '"' . $srcset . ' alt="" /> ';
}
$entry_text .= $entry['title'];
echo str_pad('', ($level - 1) * 2) . ' <li>' . generate_menu_link($entry['url'], $entry_text, $entry['count']) . '</li>' . PHP_EOL;
}
}
示例15: Date
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0, menubar=0,resizable=1,width=550,height=600');");
}
// End -->
</script>
<script src="js/bootstrap.min.js"></script>
<?php
// No dropdowns on touch gadgets
if ($_SESSION['touch'] != 'yes') {
echo '<script type="text/javascript" src="js/twitter-bootstrap-hover-dropdown.min.js"></script>';
}
// Same as in overlib_link()
if ($config['web_mouseover'] && detect_browser() != 'mobile') {
echo '<script type="text/javascript" src="js/jquery.qtip.min.js"></script>';
}
?>
<script type="text/javascript" src="js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="js/bootstrap-select.min.js"></script>
<script type="text/javascript">$('.selectpicker').selectpicker();</script>
<script type="text/javascript" src="js/bootstrap-switch.min.js"></script>
<script type="text/javascript" src="js/observium.js"></script>
</body>
</html>