| | |
| | | <?php |
| | | |
| | | /* |
| | | * $Author :PHPYUN开发团队 |
| | | * |
| | | * 官网: http://www.phpyun.com |
| | | * |
| | | * 版权所有 2009-2021 宿迁鑫潮信息技术有限公司,并保留所有权利。 |
| | | * |
| | | * 软件声明:未经授权前提下,不得用于商业运营、二次开发以及任何形式的再次发布。 |
| | | * |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 功能性通用函数库 |
| | | */ |
| | |
| | | * @param $mobile |
| | | * @return bool |
| | | */ |
| | | function CheckMobile($mobile) |
| | | { |
| | | function CheckMobile($mobile) { |
| | | if (!preg_match("/1[3456789]{1}\d{9}$/", trim($mobile))) { |
| | | return false; |
| | | return FALSE; |
| | | } else { |
| | | return true; |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | function CheckRegUser($str) |
| | | { |
| | | |
| | | function CheckRegUser($str) { |
| | | if (!preg_match("/^[\x{4e00}-\x{9fa5}A-Za-z0-9\-@#.\$_!]+$/u", $str)) { |
| | | return false; |
| | | return FALSE; |
| | | } else { |
| | | return true; |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | | function CheckTell($str) |
| | | { |
| | | |
| | | function CheckTell($str) { |
| | | if (preg_match("/^[0-9-]+?$/", $str) == 0) { |
| | | return false; |
| | | return FALSE; |
| | | } else { |
| | | return true; |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param $email |
| | | * @return bool |
| | | */ |
| | | function CheckRegEmail($email) |
| | | { |
| | | function CheckRegEmail($email) { |
| | | if (!preg_match('/^([a-zA-Z0-9\-]+[_|\_|\.]?)*[a-zA-Z0-9\-]+@([a-zA-Z0-9\-]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,4}$/', $email)) { |
| | | return false; |
| | | return FALSE; |
| | | } else { |
| | | return true; |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param $name |
| | | * @return string |
| | | */ |
| | | function regUserNameComplex($name) |
| | | { |
| | | function regUserNameComplex($name) { |
| | | |
| | | $msg = ''; |
| | | |
| | |
| | | * @param $name |
| | | * @return string |
| | | */ |
| | | function regPassWordComplex($name) |
| | | { |
| | | function regPassWordComplex($name) { |
| | | |
| | | $msg = ''; |
| | | |
| | |
| | | * @param bool $two |
| | | * @return array|string |
| | | */ |
| | | function ArrayToString($obj, $withKey = true, $two = false) |
| | | { |
| | | function ArrayToString($obj, $withKey = TRUE, $two = FALSE) { |
| | | if (empty($obj)) return array(); |
| | | |
| | | $objType = gettype($obj); |
| | |
| | | /** |
| | | * 获取真实IP地址否则返回Unknown |
| | | */ |
| | | function fun_ip_get() |
| | | { |
| | | function fun_ip_get() { |
| | | |
| | | if (!empty($_SERVER['HTTP_CLIENT_IP'])) { |
| | | |
| | |
| | | * @param $str |
| | | * @return string |
| | | */ |
| | | function is_ip($str) |
| | | { |
| | | function is_ip($str) { |
| | | |
| | | if (stripos($str, ',') !== false) { |
| | | if (stripos($str, ',') !== FALSE) { |
| | | |
| | | $strArr = explode(',', $str); |
| | | $ip = $strArr[0]; |
| | |
| | | * @param int $lev |
| | | * @return int |
| | | */ |
| | | function getLev($id, $parent, $lev = 1) |
| | | { |
| | | function getLev($id, $parent, $lev = 1) { |
| | | |
| | | $lhead = 0; |
| | | if ($parent[$id] > $lhead) { //存在父ID 则继续向下探寻 直到父ID 为一级类别 |
| | |
| | | /** |
| | | * 返回当前城市 |
| | | */ |
| | | function getLocalCity() |
| | | { |
| | | function getLocalCity() { |
| | | $ip = fun_ip_get(); |
| | | $cityInfo = array(); |
| | | $url = "http://user.58.com/userdata/getlocal/"; |
| | |
| | | curl_setopt($curl, CURLOPT_TIMEOUT, 1); |
| | | $ret = curl_exec($curl); |
| | | |
| | | if (false !== $ret) { |
| | | if (FALSE !== $ret) { |
| | | |
| | | $ret = str_replace('list', '"list"', $ret); |
| | | $ret = str_replace('local', '"local"', $ret); |
| | | $ret = str_replace('ishome', '"ishome"', $ret); |
| | | $ret = str_replace("'", '"', $ret); |
| | | $output = json_decode($ret, true); |
| | | $output = json_decode($ret, TRUE); |
| | | |
| | | curl_close($curl); |
| | | |
| | |
| | | |
| | | foreach ($city_name as $tck => $cn) { |
| | | |
| | | if (strpos($cn, $local) !== false) { |
| | | if (strpos($cn, $local) !== FALSE) { |
| | | |
| | | $lev = getLev($tck, $city_parent); |
| | | |
| | |
| | | return $cityInfo; |
| | | } |
| | | |
| | | function go_to_city($config) |
| | | { |
| | | function go_to_city($config) { |
| | | |
| | | $city = getLocalCity(); |
| | | |
| | |
| | | * @param string $default |
| | | * @return mixed|string |
| | | */ |
| | | function dreferer($default = '') |
| | | { |
| | | function dreferer($default = '') { |
| | | |
| | | $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; |
| | | |
| | |
| | | /** |
| | | * 判断是否是手机或PC客户端来路 |
| | | */ |
| | | function UserAgent() |
| | | { |
| | | function UserAgent() { |
| | | $user_agent = (!isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT']; |
| | | |
| | | if ((preg_match("/(iphone|ipod|android)/i", strtolower($user_agent))) and strstr(strtolower($user_agent), 'webkit')) { |
| | | |
| | | return true; |
| | | return TRUE; |
| | | } else if (trim($user_agent) == '' or preg_match("/(nokia|sony|ericsson|mot|htc|samsung|sgh|lg|philips|lenovo|ucweb|opera mobi|windows mobile|blackberry)/i", strtolower($user_agent))) { |
| | | |
| | | return true; |
| | | return TRUE; |
| | | } else { |
| | | |
| | | return true; |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param $host |
| | | * @return mixed |
| | | */ |
| | | function get_domain($host) |
| | | { |
| | | function get_domain($host) { |
| | | |
| | | $host = strtolower($host); |
| | | |
| | | if (strpos($host, '/') !== false) { |
| | | if (strpos($host, '/') !== FALSE) { |
| | | $parse = @parse_url($host); |
| | | $host = $parse['host']; |
| | | } |
| | |
| | | * @param $array |
| | | * @param $config |
| | | */ |
| | | function made_web($dir, $array, $config) |
| | | { |
| | | function made_web($dir, $array, $config) { |
| | | |
| | | $content = "<?php \n"; |
| | | $content .= "\$$config=" . $array . ";"; |
| | |
| | | * @param $array |
| | | * @return |
| | | */ |
| | | function made_web_array($dir, $array) |
| | | { |
| | | function made_web_array($dir, $array) { |
| | | |
| | | $content = "<?php \n"; |
| | | |
| | |
| | | * @param string $string |
| | | * @return string |
| | | */ |
| | | function made_string($array, $string = '') |
| | | { |
| | | function made_string($array, $string = '') { |
| | | |
| | | if (is_array($array) && !empty($array)) { |
| | | $i = 0; |
| | |
| | | * @param $delFiles |
| | | * @return bool |
| | | */ |
| | | function delfiledir($delFiles) |
| | | { |
| | | function delfiledir($delFiles) { |
| | | $delFiles = stripslashes($delFiles); |
| | | $delFiles = str_replace("../", "", $delFiles); |
| | | $delFiles = str_replace("./", "", $delFiles); |
| | |
| | | } |
| | | @closedir($dh); |
| | | if (@rmdir($delFiles)) { |
| | | return true; |
| | | return TRUE; |
| | | } else { |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | } |
| | | } |
| | |
| | | * @param $path |
| | | * @return string |
| | | */ |
| | | function path_tidy($path) |
| | | { |
| | | function path_tidy($path) { |
| | | $tidy = array(); |
| | | $path = strtr($path, '\\', '/'); |
| | | foreach (explode('/', $path) as $i => $item) { |
| | |
| | | * 其中 1 = GIF,2 = JPG,3 = PNG,4 = SWF,5 = PSD,6 = BMP,7 = TIFF(intel byte order),8 = TIFF(motorola byte order),9 = JPC,10 = JP2,11 = JPX,12 = JB2,13 = SWC,14 = IFF,15 = WBMP,16 = XBM |
| | | * @param $pic |
| | | */ |
| | | function unlink_pic($pic) |
| | | { |
| | | function unlink_pic($pic) { |
| | | $picType = getimagesize($pic); |
| | | if ($picType[2] == '1' || $picType[2] == '2' || $picType[2] == '3') { |
| | | |
| | |
| | | * @param $array |
| | | * @return int |
| | | */ |
| | | function pylode($string, $array) |
| | | { |
| | | function pylode($string, $array) { |
| | | if (is_array($array)) { |
| | | |
| | | $str = @implode($string, $array); |
| | |
| | | * 获取微信 TOKEN |
| | | * @return mixed |
| | | */ |
| | | function getToken() |
| | | { |
| | | function getToken() { |
| | | |
| | | $config = ''; |
| | | include(PLUS_PATH . 'configcache.php'); |
| | |
| | | * 获取企业微信 TOKEN |
| | | * @return mixed |
| | | */ |
| | | function getWxQyToken() |
| | | { |
| | | function getWxQyToken() { |
| | | |
| | | $config = ''; |
| | | |
| | |
| | | /** |
| | | * 获取微信 JS TOKEN |
| | | */ |
| | | function getWxTicket() |
| | | { |
| | | function getWxTicket() { |
| | | |
| | | include(PLUS_PATH.'configcache.php'); |
| | | |
| | |
| | | * @param string $url |
| | | * @return array |
| | | */ |
| | | function getWxJsSdk($url = '') |
| | | { |
| | | function getWxJsSdk($url = '') { |
| | | include(PLUS_PATH.'config.php'); |
| | | |
| | | $Ticket = getWxTicket(); |
| | |
| | | * @param string $headers |
| | | * @return |
| | | */ |
| | | function CurlPost($url, $data = '', $multiple = 1, $headers = '') |
| | | { |
| | | function CurlPost($url, $data = '', $multiple = 1, $headers = '') { |
| | | |
| | | $ch = curl_init(); |
| | | curl_setopt($ch, CURLOPT_URL, $url); |
| | |
| | | * @param $url |
| | | * @return |
| | | */ |
| | | function CurlGet($url) |
| | | { |
| | | function CurlGet($url) { |
| | | $ch = curl_init(); |
| | | $timeout = 20; |
| | | curl_setopt($ch, CURLOPT_URL, $url); |
| | | curl_setopt($ch, CURLOPT_HEADER, false); |
| | | curl_setopt($ch, CURLOPT_HEADER, FALSE); |
| | | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| | | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // 跳过证书检查 |
| | | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 从证书中检查SSL加密算法是否存在 |
| | |
| | | * @param $config |
| | | * @return string |
| | | */ |
| | | function wapJump($config) |
| | | { |
| | | function wapJump($config) { |
| | | |
| | | global $ModuleName; |
| | | $Loaction = ''; |
| | |
| | | * 使用终端是否手机判断方法 |
| | | * @return bool |
| | | */ |
| | | function isMobileUser() |
| | | { |
| | | function isMobileUser() { |
| | | |
| | | $uachar = '/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile|phone|iphone|ipad|ipod|android|symbian|smartphone)/i'; |
| | | |
| | |
| | | |
| | | if (preg_match($uachar, $ua)) { |
| | | |
| | | return true; |
| | | return TRUE; |
| | | } else { |
| | | |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param int $length |
| | | * @return |
| | | */ |
| | | function gt_Generate_code($length = 6) |
| | | { |
| | | function gt_Generate_code($length = 6) { |
| | | return rand(pow(10, ($length - 1)), pow(10, $length) - 1); |
| | | } |
| | | |
| | |
| | | * @param $config |
| | | * @return string[] |
| | | */ |
| | | function verifytoken($config) |
| | | { |
| | | function verifytoken($config) { |
| | | |
| | | if ($config['code_kind'] == '3') { |
| | | |
| | |
| | | * @param array $config |
| | | * @return bool |
| | | */ |
| | | function vaptchacode($config = array()) |
| | | { |
| | | function vaptchacode($config = array()) { |
| | | |
| | | if (empty($config)) { |
| | | |
| | |
| | | $vaptchaReturn = json_decode($CurlReturn); |
| | | if ($vaptchaReturn->success == '1') { |
| | | |
| | | return true; |
| | | return TRUE; |
| | | } else { |
| | | |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param array $config |
| | | * @return bool |
| | | */ |
| | | function gtGeetest($config = array()) |
| | | { |
| | | function gtGeetest($config = array()) { |
| | | |
| | | if ($_POST['verify_token']) { |
| | | |
| | |
| | | if ($_SESSION['gtserver'] == 1) { //服务器正常 |
| | | $result = $GtSdk->success_validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode'], $data); |
| | | if ($result) { |
| | | return true; |
| | | return TRUE; |
| | | } else { |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | } else { //服务器宕机,走failback模式 |
| | | if ($GtSdk->fail_validate($_POST['geetest_challenge'], $_POST['geetest_validate'], $_POST['geetest_seccode'])) { |
| | | return true; |
| | | return TRUE; |
| | | } else { |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | } |
| | | } else { |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param array $config |
| | | * @return bool |
| | | */ |
| | | function dxauthcode($config = array()) |
| | | { |
| | | function dxauthcode($config = array()) { |
| | | include(LIB_PATH . "dxCaptchaClient.class.php"); |
| | | |
| | | /** |
| | |
| | | |
| | | //确保验证状态是SERVER_SUCCESS,SDK中有容错机制,在网络出现异常的情况会返回通过 |
| | | if($response->serverStatus == 'SERVER_SUCCESS'){ |
| | | return true; |
| | | return TRUE; |
| | | /**token验证通过,继续其他流程**/ |
| | | } else { |
| | | return false; |
| | | return FALSE; |
| | | /**token验证失败**/ |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 获取数字验码 |
| | | */ |
| | | function gtverify() |
| | | { |
| | | function gtverify() { |
| | | if (md5(strtolower($_POST['authcode'])) != $_SESSION['authcode'] || empty($_SESSION['authcode'])) { |
| | | unset($_SESSION['authcode']); |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | return true; |
| | | return TRUE; |
| | | } |
| | | |
| | | /** |
| | | * @return bool |
| | | */ |
| | | function is_weixin() |
| | | { |
| | | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false) { |
| | | return true; |
| | | function is_weixin() { |
| | | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== FALSE) { |
| | | return TRUE; |
| | | } |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param $time |
| | | * @param $domain |
| | | */ |
| | | function setcookies($parseDate = array(), $time, $domain) |
| | | { |
| | | function setcookies($parseDate = array(), $time, $domain) { |
| | | |
| | | $domain = get_domain($domain); |
| | | if (is_array($parseDate)) { |
| | |
| | | |
| | | // 上面方法得到的密文太长,不适合放入承载信息有限的二维码中 |
| | | // 加密 |
| | | function yunEncrypt($str, $key) |
| | | { |
| | | function yunEncrypt($str, $key) { |
| | | $key = md5($key); |
| | | $k = md5(rand(0, 100)); // 相当于动态密钥 |
| | | $k = substr($k, 0, 3); |
| | |
| | | } |
| | | |
| | | // 解密 |
| | | function yunDecrypt($str, $key) |
| | | { |
| | | function yunDecrypt($str, $key) { |
| | | $len = strlen($str); |
| | | $key = md5($key); |
| | | $str = base64_decode($str); |
| | |
| | | /** |
| | | * 数组排序 |
| | | */ |
| | | function my_sort($prev, $next) |
| | | { |
| | | function my_sort($prev, $next) { |
| | | if ($prev['value'] == $next['value']) return 0; |
| | | return ($prev['value'] < $next['value']) ? 1 : -1; |
| | | } |
| | | |
| | | /** |
| | | * @param $prev |
| | | * @param $next |
| | | * @return int |
| | | */ |
| | | function t_sort($prev, $next) |
| | | { |
| | | function t_sort($prev, $next) { |
| | | $p = strtotime($prev); |
| | | $n = strtotime($next); |
| | | if ($p == $n) return 0; |
| | |
| | | /** |
| | | * 判断当前服务器是windows系统还是其他系统 |
| | | */ |
| | | function isServerOsWindows() |
| | | { |
| | | return stristr(php_uname('s'), 'window') ? true : false; |
| | | function isServerOsWindows() { |
| | | return stristr(php_uname('s'), 'window') ? TRUE : FALSE; |
| | | } |
| | | |
| | | /** |
| | | * @param $serial_str |
| | | * @return mixed |
| | | */ |
| | | function mb_unserialize($serial_str) |
| | | { |
| | | function mb_unserialize($serial_str) { |
| | | $serial_str = str_replace("\r", "", $serial_str); |
| | | $serial_str = preg_replace_callback('/s:\d+:"(.+?)";/s', 'checkunserialize', $serial_str); |
| | | return unserialize($serial_str); |
| | |
| | | * @param $r |
| | | * @return string |
| | | */ |
| | | function checkunserialize($r) |
| | | { |
| | | function checkunserialize($r) { |
| | | $n = strlen($r[1]); |
| | | return "s:$n:\"$r[1]\";"; |
| | | } |
| | |
| | | * @param $str |
| | | * @return string |
| | | */ |
| | | function sub_string($str) |
| | | { |
| | | function sub_string($str) { |
| | | |
| | | $length = mb_strlen($str); |
| | | if ($length > 5 && (CheckMobile($str) || CheckRegEmail($str))) { |
| | |
| | | * @param string $url 现有路径 |
| | | * @return string |
| | | */ |
| | | function checkpic($url = '', $post = '') |
| | | { |
| | | function checkpic($url = '', $post = '') { |
| | | |
| | | global $config; |
| | | |
| | |
| | | |
| | | if ($url != '') { |
| | | |
| | | if (strstr($url, 'http') !== false || strstr($url, 'https') !== false) { |
| | | if (strstr($url, 'http') !== FALSE || strstr($url, 'https') !== FALSE) { |
| | | |
| | | $picurl = $url; |
| | | |
| | | } else { |
| | | |
| | | if (strstr($url, '../data') !== false) { |
| | | if (strstr($url, '../data') !== FALSE) { |
| | | |
| | | $picurl = str_replace('../data', $curl . '/data', $url); |
| | | |
| | | } elseif (strstr($url, './data') !== false) { |
| | | } elseif (strstr($url, './data') !== FALSE) { |
| | | |
| | | $picurl = str_replace('./data', $curl . '/data', $url); |
| | | |
| | | } elseif (strstr($url, '/data') !== false) { |
| | | } elseif (strstr($url, '/data') !== FALSE) { |
| | | |
| | | $picurl = str_replace('/data', $curl . '/data', $url); |
| | | } elseif (strstr($url, '.data') !== false) { |
| | | } elseif (strstr($url, '.data') !== FALSE) { |
| | | |
| | | $picurl = str_replace('.data', $curl . '/data', $url); |
| | | |
| | |
| | | |
| | | if ($post != '') { |
| | | |
| | | if (strstr($post, 'http') !== false || strstr($url, 'https') !== false) { |
| | | if (strstr($post, 'http') !== FALSE || strstr($url, 'https') !== FALSE) { |
| | | |
| | | $picurl = $post; |
| | | } else { |
| | |
| | | * @param string $oldpass |
| | | * @return bool |
| | | */ |
| | | function passCheck($pass, $salt = '', $oldpass = '') |
| | | { |
| | | function passCheck($pass, $salt = '', $oldpass = '') { |
| | | |
| | | include_once(LIB_PATH . "pwdtype/phpyunpass.php"); |
| | | return passwordCheck($pass, $salt, $oldpass); |
| | |
| | | * @param string $weburl |
| | | * @return string |
| | | */ |
| | | function getprotocol($weburl = '') |
| | | { |
| | | function getprotocol($weburl = '') { |
| | | |
| | | if ($weburl) { |
| | | if (strpos($weburl, 'https://') !== false) { |
| | | if (strpos($weburl, 'https://') !== FALSE) { |
| | | |
| | | $protocol = 'https://'; |
| | | } else { |
| | |
| | | * @param string $format |
| | | * @return string |
| | | */ |
| | | function format_datetime($date_time, $type = 1, $before = 1, $format = '') |
| | | { |
| | | function format_datetime($date_time, $type = 1, $before = 1, $format = '') { |
| | | if ($type == 1) { |
| | | |
| | | $timestamp = strtotime($date_time); |
| | |
| | | * @param sting/int $date_time |
| | | * @return string |
| | | */ |
| | | function lastupdateStyle($date_time) |
| | | { |
| | | function lastupdateStyle($date_time) { |
| | | global $config; |
| | | |
| | | $type = $config['sy_updates_set']; |
| | |
| | | return date('Y-m-d', $date_time); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 时间格式化:今天(时.分) 今年(月.日) 其他(年-月-日) |
| | | * @param string $time |
| | |
| | | } |
| | | return $str; |
| | | } |
| | | |
| | | /** |
| | | * 处理掉二维数组中值为空的参数 |
| | | * @param $arr |
| | | * @return mixed |
| | | */ |
| | | function removeEmpty($arr) |
| | | { |
| | | function removeEmpty($arr) { |
| | | |
| | | foreach ($arr as $k => $v) { |
| | | foreach ($v as $mk => $mv) { |
| | |
| | | * @param int $endtime |
| | | * @return boolean |
| | | */ |
| | | function isVip($endtime = 0) |
| | | { |
| | | function isVip($endtime = 0) { |
| | | |
| | | if ($endtime >= strtotime('today') || $endtime == 0) { |
| | | |
| | | return true; |
| | | return TRUE; |
| | | } else { |
| | | |
| | | return false; |
| | | return FALSE; |
| | | } |
| | | } |
| | | |
| | | function changeSalary($salary) |
| | | { |
| | | function changeSalary($salary) { |
| | | global $config; |
| | | if ($salary > 0) { |
| | | if ($config['resume_salarytype'] == 2) { |
| | |
| | | /** |
| | | * 产生随机字符串 |
| | | */ |
| | | function createstr($length = 10) |
| | | { |
| | | function createstr($length = 10) { |
| | | |
| | | $chars = "abfghijklmprtvwyz0123456789"; |
| | | $str = ""; |
| | |
| | | return $str; |
| | | } |
| | | |
| | | function checkMsgOpen($config) |
| | | { |
| | | function checkMsgOpen($config) { |
| | | |
| | | if ($config["sy_msg_appkey"] == "" || $config["sy_msg_appsecret"] == "" || $config['sy_msg_isopen'] != '1') { |
| | | |
| | | return false; |
| | | return FALSE; |
| | | } else { |
| | | |
| | | return true; |
| | | return TRUE; |
| | | } |
| | | } |
| | | |
| | |
| | | * @return false|string |
| | | */ |
| | | function formatTime($time){ |
| | | |
| | | if ($time > strtotime(date('Y-m-d'))) { |
| | | |
| | | $time_n = '今天 '.date('H:i', $time); |
| | | } else if ($time > mktime(0, 0, 0, 1, 1, date('Y'))) { |
| | | |
| | | $time_n = date('m月d日', $time); |
| | | } else { |
| | | |
| | | $time_n = date('Y-m-d', $time); |
| | | } |
| | | |
| | | return $time_n; |
| | | } |
| | | |
| | |
| | | * @param $long |
| | | * @return string |
| | | */ |
| | | function avgToYm($long) |
| | | { |
| | | function avgToYm($long) { |
| | | if ($long >= 12) { |
| | | |
| | | if (bcmod($long, 12) > 0) { |
| | | |
| | | $return = floor($long / 12) . '年' . bcmod($long, 12); |
| | | } else { |
| | | |
| | | $return = floor($long / 12) . '年'; |
| | | } |
| | | |
| | | } else { |
| | | |
| | | $return = $long; |
| | | } |
| | | |
| | | return $return; |
| | | } |
| | | |
| | | ?> |