Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
U
User
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangjun
User
Commits
c992801a
Commit
c992801a
authored
Jul 01, 2024
by
fangliyan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小区收藏
parent
5bb0d3a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
80 deletions
+80
-80
function_helper.php
esf_core/helpers/function_helper.php
+80
-80
No files found.
esf_core/helpers/function_helper.php
View file @
c992801a
...
...
@@ -2,12 +2,12 @@
/**
* sendsms($mobile,$msg)
*
*
发送短信
*
发送短信
* @param none
* @global none
* @return void
* @update 2011-10-25
*/
*/
function
sendsms
(
$mobile
,
$msg
,
$type
=
'ad'
,
$yzm
=
""
)
{
get_api
(
API_ESF_SENDSMS
.
"?conf_cityflag=nj&mobile="
.
$mobile
.
"&msg="
.
urlencode
(
$msg
)
.
"&type="
.
$type
.
"&ymz="
.
$yzm
);
...
...
@@ -16,8 +16,8 @@ function sendsms($mobile,$msg,$type='ad',$yzm="")
/**
* get_api($url, $nocache = 0)
*
*
接口函数 F
isher 2013-1-12
*/
*
接口函数
Fisher 2013-1-12
*/
if
(
!
function_exists
(
'get_api'
))
{
function
get_api
(
$url
,
$nocache
=
0
)
...
...
@@ -28,7 +28,7 @@ if(!function_exists('get_api'))
}
function
curl_get_contents
(
$str
,
$t_url
=
""
)
{
{
$ch
=
curl_init
();
$t_url
=
$t_url
?
$t_url
:
"http://"
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
curl_setopt
(
$ch
,
CURLOPT_URL
,
$str
);
...
...
@@ -38,7 +38,7 @@ function curl_get_contents($str,$t_url="")
$str
=
curl_exec
(
$ch
);
curl_close
(
$ch
);
return
$str
;
}
}
function
curl_get_contents_new
(
$str
,
$t_url
=
""
,
$cookie
=
''
)
{
...
...
@@ -61,12 +61,12 @@ function curl_get_contents_new($str,$t_url="", $cookie = '')
/**
* random($length)
*
*
产生随机数函数
*
产生随机数函数
* @param none
* @global none
* @return void
* @update 2011-10-25
*/
*/
function
random
(
$length
)
{
$hash
=
''
;
$chars
=
'123456789'
;
...
...
@@ -90,14 +90,14 @@ if(!function_exists('jumpto'))
if
(
!
function_exists
(
'jumptotk'
))
{
function
jumptotk
(
$url
,
$message
=
"执行完毕!"
,
$sec
=
3000
,
$template
=
"tips"
)
function
jumptotk
(
$url
,
$message
=
"执行完毕!
"
,
$sec
=
3000
,
$template
=
"tips"
)
{
if
(
$template
==
'tips'
)
{
echo
'<div class="pop" style="width:390px;height:160px; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;border:1px solid #ccc;">
<div class="hd" style="height:40px;background:#FF8400">
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">
提示<
/h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('
.
USER_CENTER
.
'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''
.
$url
.
'\'">
关闭<
/a>
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">
提示
</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('
.
USER_CENTER
.
'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''
.
$url
.
'\'">
关闭
</a>
</div>
<div class="bd" style="background:#fff;height:120px">
<div style="width:70px;height:80px;background:url('
.
USER_CENTER
.
'images/pop-ico.gif) no-repeat; position:absolute;left:70px;top:60px"></div>
...
...
@@ -107,8 +107,8 @@ if(!function_exists('jumptotk'))
}
elseif
(
$template
==
'tipswaring'
){
echo
'<div class="pop" style="width:390px;height:160px;border:1px solid #ccc; position:absolute;left:50%;top:50%;margin-left:-200px;margin-top:-120px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca;">
<div class="hd" style="height:40px;background:#FF8400">
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">
提示<
/h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('
.
USER_CENTER
.
'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''
.
$url
.
'\'">
关闭<
/a>
<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">
提示
</h2>
<a href="javascript:void(0)" class="close-pop" style="display:block;width:30px;height:30px;background:url('
.
USER_CENTER
.
'images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" onclick="location.href=\''
.
$url
.
'\'">
关闭
</a>
</div>
<div style="width:70px;height:80px;background:url('
.
USER_CENTER
.
'images/pop-ico.gif) no-repeat -2px -113px; position:absolute;left:70px;top:60px"></div>
<p style="position:absolute;left:160px;top:85px;font-size:14px">'
.
$message
.
'</p>
...
...
@@ -123,7 +123,7 @@ if(!function_exists('jumptotk'))
function
tel_yc
(
$tel
)
{
//
隐藏手机号部分数字
//
隐藏手机号部分数字
$pattern
=
"/(1\d
{
1,2})\d\d(\d{0,3
}
)/"
;
$replacement
=
"
\$
1****
\$
3"
;
...
...
@@ -131,7 +131,7 @@ function tel_yc($tel)
}
/*
设置登录co
okie*/
/*
设置登录
cookie*/
function
vbsetcookie
(
$name
,
$value
=
""
,
$permanent
=
1
)
{
$cookiedomain
=
".house365.com"
;
...
...
@@ -147,7 +147,7 @@ function vbsetcookie($name,$value="",$permanent=1) {
}
/*
设置c
ookie,session*/
/*
设置
cookie,session*/
function
setcoandsess
(
$name
,
$value
=
""
,
$permanent
=
1
)
{
$cookiedomain
=
".house365.com"
;
...
...
@@ -179,11 +179,11 @@ function StrCode($string,$action='ENCODE'){
/**
* GetIP -
获取客户端IP地址
* GetIP -
获取客户端IP地址
*
* @access public
* @param none
* @return string IP
地址
* @return string IP
地址
*/
if
(
!
function_exists
(
'get_ip'
))
{
...
...
@@ -205,7 +205,7 @@ if ( ! function_exists('get_ip'))
//
南京站根据表名和房源ID获取房源图片存储的表名称
//
南京站根据表名和房源ID获取房源图片存储的表名称
if
(
!
function_exists
(
'get_upload_tblname'
))
{
function
get_upload_tblname
(
$tbl
,
$id
){
...
...
@@ -386,8 +386,8 @@ if ( ! function_exists('get_upload_tblname'))
/**
*
获取二手房的房源地址
* @param array $row
房源信息,必须含有id
*
获取二手房的房源地址
* @param array $row
房源信息,必须含有
id
* @return stirng
*/
if
(
!
function_exists
(
'get_sellinfo_url'
))
...
...
@@ -407,8 +407,8 @@ if(!function_exists('get_sellinfo_url'))
/**
*
获取求购地址
* @param array $row
房源信息,必须含有id
*
获取求购地址
* @param array $row
房源信息,必须含有
id
* @return stirng
*/
if
(
!
function_exists
(
'get_buyinfo_url'
))
...
...
@@ -426,13 +426,13 @@ if(!function_exists('get_buyinfo_url'))
}
/**
*
获取租房的房源地址
* @param array $row
房源信息,必须含有id
*
获取租房的房源地址
* @param array $row
房源信息,必须含有
id
* @return stirng
*/
if
(
!
function_exists
(
'get_rentinfo_url'
))
{
function
get_rentinfo_url
(
$row
,
$pre
=
'r'
)
//
房源地址
function
get_rentinfo_url
(
$row
,
$pre
=
'r'
)
//
房源地址
{
if
(
is_array
(
$row
))
{
if
(
!
empty
(
$row
[
'ID'
]))
$id
=
$row
[
'ID'
];
...
...
@@ -448,13 +448,13 @@ if(!function_exists('get_rentinfo_url'))
}
/**
*
获取问答地址
*
获取问答地址
* @param array $qid
* @return stirng
*/
if
(
!
function_exists
(
'get_questioninfo_url'
))
{
function
get_questioninfo_url
(
$qid
)
//房源地址
function
get_questioninfo_url
(
$qid
)
//房源地址
{
$ss
=
GB_SELL_URL
.
"/ask_"
.
$qid
.
".html"
;
return
$ss
;
...
...
@@ -464,62 +464,62 @@ if(!function_exists('get_questioninfo_url'))
/**
*
获取小区地址
*
获取小区地址
* @param array $id
* @return stirng
*/
function
get_blockinfo_url
(
$id
)
{
function
get_blockinfo_url
(
$id
)
{
$ss
=
GB_SELL_URL
.
"/community_id"
.
$id
.
"/"
;
return
$ss
;
}
}
/**
*获取学校地址
/**
*获取学校地址
*@param int $id
*@return string
*/
function
get_school_url
(
$id
){
function
get_school_url
(
$id
){
$url
=
GB_SELL_URL
.
"/school_id"
.
$id
.
"/"
;
return
$url
;
}
}
/**
*获取学校小区地址
/**
*获取学校小区地址
*@param int $id
*@return string
*/
function
get_schoolblock_url
(
$id
){
function
get_schoolblock_url
(
$id
){
$url
=
GB_SELL_URL
.
"/school_id"
.
$id
.
"/community.html"
;
return
$url
;
}
}
/**
*获取学校二手房地址
/**
*获取学校二手房地址
*@param int $id
*@return string
*/
function
get_schoolsell_url
(
$id
){
function
get_schoolsell_url
(
$id
){
$url
=
GB_SELL_URL
.
"/school_id"
.
$id
.
"/sell.html"
;
return
$url
;
}
}
/**
*获取学校租房地址
/**
*获取学校租房地址
*@param int $id
*@return string
*/
function
get_schoolrent_url
(
$id
){
function
get_schoolrent_url
(
$id
){
$url
=
GB_SELL_URL
.
"/school_id"
.
$id
.
"/rent.html"
;
return
$url
;
}
}
/**
*
判断值是否为数组
*
判断值是否为数组
* @param array $arrValue
* @return bool true or false
* @author sun
...
...
@@ -529,11 +529,11 @@ function isFullArray($arrValue) {
}
/**
* time_tran 距离现在时间多久
*
* @param string $the_time 时间参数
* @return string 描述字符串
*/
* time_tran 距离现在时间多久
*
* @param string $the_time 时间参数
* @return string 描述字符串
*/
function
time_tran
(
$the_time
)
{
$now_time
=
time
();
...
...
@@ -543,22 +543,22 @@ function time_tran ($the_time) {
$str
=
$the_time
;
}
else
{
if
(
$dur
<
60
){
$str
=
$dur
.
'
秒前'
;
$str
=
$dur
.
'
秒前
'
;
}
else
if
(
$dur
<
3600
){
$str
=
floor
(
$dur
/
60
)
.
'
分钟前'
;
$str
=
floor
(
$dur
/
60
)
.
'
分钟前
'
;
}
else
if
(
$dur
<
86400
){
$str
=
floor
(
$dur
/
3600
)
.
'
小时前'
;
$str
=
floor
(
$dur
/
3600
)
.
'
小时前
'
;
}
else
if
(
$dur
<
259200
){
$str
=
floor
(
$dur
/
86400
)
.
'
天前'
;
$str
=
floor
(
$dur
/
86400
)
.
'
天前
'
;
}
else
if
(
$dur
>
259200
){
$str
=
date
(
'Y-m-d H:i'
,
$the_time
);
}
}
return
$str
;
}
}
//
加密,解密函数 F
ISHER 2014-3-5
//
加密,解密函数
FISHER 2014-3-5
function
passport_encrypt
(
$txt
,
$key
=
'fisher.house365.com'
)
{
srand
((
double
)
microtime
()
*
1000000
);
$encrypt_key
=
md5
(
rand
(
0
,
32000
));
...
...
@@ -593,26 +593,26 @@ function passport_key($txt, $encrypt_key) {
function
check_input
(
$value
)
{
//
去除斜杠
if
(
get_magic_quotes_gpc
())
//
去除斜杠
if
(
get_magic_quotes_gpc
())
{
$value
=
stripslashes
(
$value
);
}
//
如果不是数字则加引号
if
(
!
is_numeric
(
$value
))
//
如果不是数字则加引号
if
(
!
is_numeric
(
$value
))
{
$value
=
"'"
.
mysql_real_escape_string
(
$value
)
.
"'"
;
}
return
$value
;
return
$value
;
}
/**
* jsonNew
对数据进行gbk转utf8后json编码 js
on($data)
* @param mixed $data
需要编码的数据
* @return mixed $data_json
编码后的数据
* jsonNew
对数据进行gbk转utf8后json编码
json($data)
* @param mixed $data
需要编码的数据
* @return mixed $data_json
编码后的数据
* @ 2012-10-16 xz
**/
**/
function
jsonNew
(
$data
,
$inChar
=
"GBK"
,
$outChar
=
"UTF-8"
)
{
if
(
!
$data
)
return
$data
;
...
...
@@ -621,8 +621,8 @@ function jsonNew($data,$inChar="GBK",$outChar="UTF-8") {
}
/**
*
替换数组编码(支持字符串和多维数组)
/**
*
替换数组编码(支持字符串和多维数组
)
* @param mixed $strInput
* @param string $inChar
* @param string $outChar
...
...
@@ -647,25 +647,25 @@ function strIconv($strInput,$inChar="GBK",$outChar="UTF-8"){
}
//
通过curl模拟post的请求;
//
通过curl模拟post的请求;
function
SendDataByCurl
(
$url
,
$data
=
array
()){
//
对空格进行转义
//
对空格进行转义
$url
=
str_replace
(
' '
,
'+'
,
$url
);
$ch
=
curl_init
();
//
设置选项,包括URL
//
设置选项,包括U
RL
curl_setopt
(
$ch
,
CURLOPT_URL
,
"
$url
"
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_HEADER
,
0
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
3
);
//
定义超时3秒钟
// POST
数据
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
3
);
//
定义超时3秒钟
// POST
数据
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
//
把post的变量加上
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$data
));
//
所需传的数组用http_bulid_query()函数处理一下,就ok了
//
把post的变量加上
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$data
));
//
所需传的数组用http_bulid_query()函数处理一下,就ok了
//
执行并获取url地址的内容
//
执行并获取url地址的内容
$output
=
curl_exec
(
$ch
);
$errorCode
=
curl_errno
(
$ch
);
//
释放curl句柄
//
释放curl句柄
curl_close
(
$ch
);
if
(
0
!==
$errorCode
)
{
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment