123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- /**
- * extention.func.php 用户自定义函数库
- *
- * @copyright (C) 2005-2010 PHPCMS
- * @license http://www.phpcms.cn/license/
- * @lastmodify 2010-10-27
- */
-
- /**
- * 通过username值,查询真实姓名
- */
- function get_admin_realname($username) {
- if(empty($username)){return false;}
- $admin_db = pc_base::load_model('admin_model');
- $realname = $admin_db->get_one(array('username'=>$username),'realname');
- //如果没有真实姓名返回用户名
- if($realname['realname']) {
- return $realname['realname'];
- } else {
- return $username;
- }
- }
- function is_mobile() {
- $user_agent = $_SERVER ['HTTP_USER_AGENT'];
- $mobile_browser = Array (
- "mqqbrowser", // 手机QQ浏览器
- "opera mobi", // 手机opera
- "juc", "iuc", // uc浏览器
- "fennec",
- "ios",
- "applewebKit/420",
- "applewebkit/525",
- "applewebkit/532",
- "ipad",
- "iphone",
- "ipaq",
- "ipod",
- "iemobile",
- "windows ce", // windows phone
- "240×320",
- "480×640",
- "acer",
- "android",
- "anywhereyougo.com",
- "asus",
- "audio",
- "blackberry",
- "blazer",
- "coolpad",
- "dopod",
- "etouch",
- "hitachi",
- "htc",
- "huawei",
- "jbrowser",
- "lenovo",
- "lg",
- "lg-",
- "lge-",
- "lge",
- "mobi",
- "moto",
- "nokia",
- "phone",
- "samsung",
- "sony",
- "symbian",
- "tablet",
- "tianyu",
- "wap",
- "xda",
- "xde",
- "zte"
- );
- $is_mobile = false;
- foreach ( $mobile_browser as $device ) {
- if (stristr ( $user_agent, $device )) {
- $is_mobile = true;
- break;
- }
- }
- return $is_mobile;
- }
- ?>
|