Commit 7b5f75df authored by zhangkuanguang's avatar zhangkuanguang

bug

parent 53c62360
<?php
//函数集合
//��������
if(!function_exists('log_broker_credit')) {
function log_broker_credit($uid, $operation, $kind) {
GLOBAL $db;
......@@ -29,7 +29,7 @@ function log_agent_credit($uid, $operation, $kind) {
$db->Execute($q);
}
}
//写
//д��־
function actionlog($tbl, $rowid, $msg) {
GLOBAL $db, $web_auth;
......@@ -46,9 +46,9 @@ function actionlog($tbl, $rowid, $msg) {
}
/**
* 经纪人账号操作日志记
* �������˺Ų�����־��¼
*
* @param array 经纪人信
* @param array ��������Ϣ
*/
function brokeroperatorlog($data) {
GLOBAL $db, $web_auth;
......@@ -62,7 +62,7 @@ function brokeroperatorlog($data) {
$db->Execute($q);
}
//取IP
//��ȡIP
if(!function_exists('GetIP')) {
function GetIP() {
......@@ -95,7 +95,7 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
$td_width = "width=" . floor(100 / $td_num) . "%";
$blank_i = ceil(count($option_arr) / $td_num) * $td_num - count($option_arr);
for ($i = 0; $i < $blank_i; $i++)
$option_arr[] = "";//补全使之成为整数
$option_arr[] = "";//��ȫʹ֮��Ϊ����
$str = "<table align=center border=0 cellspacing=0 width=100%> \n";
$i = 1;
......@@ -119,7 +119,7 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
$td_width = "width=" . floor(100 / $td_num) . "%";
$blank_i = ceil(count($option_arr) / $td_num) * $td_num - count($option_arr);
for ($i = 0; $i < $blank_i; $i++)
$option_arr[] = "";//补全使之成为整数
$option_arr[] = "";//��ȫʹ֮��Ϊ����
$str = "<table align=center border=0 cellspacing=0 width=100%> \n";
$i = 1;
......@@ -142,7 +142,7 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
$td_width = "width=" . floor(100 / $td_num) . "%";
$blank_i = ceil(count($option_arr) / $td_num) * $td_num - count($option_arr);
for ($i = 0; $i < $blank_i; $i++)
$option_arr[] = "";//补全使之成为整数
$option_arr[] = "";//��ȫʹ֮��Ϊ����
$str = "<table align=center border=0 cellspacing=0 width=100%> \n";
$i = 1;
......@@ -164,14 +164,14 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
}
}
if(!function_exists('create_htmlable')) {
function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=''){//创建html标
//name标签名称|label标签类型|value标签的值(当为checkbox时为数组)|val主要用于radio和checkbox
function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=''){//����html��ǩ
//name��ǩ����|label��ǩ����|value��ǩ��ֵ(��ΪcheckboxʱΪ����)|val��Ҫ����radio��checkbox
$html = '';
if($class) $cls = 'class="'.$class.'"';
if($style) $sty = 'style="'.$style.'"';
if($name) $nam = 'name="'.$name.'"';
if($label=='text' || $label=='password'){//文本框
if($label=='text' || $label=='password'){//�ı���
if($name) $id = 'id="'.$name.'"';
$html = '<input '.$cls.' type="'.$label.'" '.$nam.' '.$id.' value="'.$value.'" '.$sty.' '.$js.'>';
}elseif($label=='radio'){//radio
......@@ -188,7 +188,7 @@ function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=
$html.=' <input type="'.$label.'" '.$nam.' '.$checked.' value="'.$key.'" '.$sty.' '.$js.'>'.$item;
}
}
}elseif($label=='select'){//下拉框
}elseif($label=='select'){//������
if(is_array($val)){
if($name) $id = 'id="'.$name.'"';
$html.='<select '.$nam.' '.$id.' '.$sty.' '.$js.'>';
......@@ -206,17 +206,17 @@ function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=
if(!function_exists('ctrl_select')) {
function ctrl_select($opt_para, $ctrl_name, $ctrl_value, $style_ext = "class=flat1") {
/** 2002.03.05
ctrl_select 函数参数说明
@param [opt_para] : opt_para是一个数组,元素含义如下
[opt_arr] 下拉框选项的数组,可以是简单数组,也可以是关联数组
[field_key] 如果是关联数组,field_key表示, 下拉框的key 出自关联数组的哪一个field,为空表示出自简单数组的key
[field_value]如果是关联数组,field_value表示,下拉框的value出自关联数组的哪一个field,为空表示出自简单数组的value
@param [ctrl_name] : select控件的名称
@param [ctrl_value] : select控件选择的值
@param [style_ext] : 扩充的样式,可以是样式或js
返回select的string
ctrl_select ��������˵��
@param [opt_para] : opt_para��һ�����飬Ԫ�غ�������
[opt_arr] ������ѡ������飬�����Ǽ����飬Ҳ�����ǹ�������
[field_key] ����ǹ������飬field_key��ʾ�� �������key ���Թ����������һ��field��Ϊ�ձ�ʾ���Լ������key
[field_value]����ǹ������飬field_value��ʾ���������value���Թ����������һ��field��Ϊ�ձ�ʾ���Լ������value
@param [ctrl_name] : select�ؼ�������
@param [ctrl_value] : select�ؼ�ѡ���ֵ
@param [style_ext] : �������ʽ����������ʽ��js
����select��string
* */
// 1.重新构建数组,将关联数组化为简单数组
// 1.���¹������飬���������黯Ϊ������
$old_opt_arr = (is_array($opt_para[opt_arr])) ? ($opt_para[opt_arr]) : (array());
FOR ($opt_arr = array(), reset($old_opt_arr), $i = 0; $i < count($old_opt_arr); $i++) {
$key = key($old_opt_arr);
......@@ -226,7 +226,7 @@ function ctrl_select($opt_para, $ctrl_name, $ctrl_value, $style_ext = "class=fla
next($old_opt_arr);
}
// 2.生成
// 2.����
$ss = "<select name=\"" . $ctrl_name . "\" " . $style_ext . ">\n";
for (reset($opt_arr), $i = 1; $i <= count($opt_arr); $i++) {
$key = key($opt_arr);
......@@ -279,13 +279,13 @@ function telnotelist($telno) {
$rs = $db->SelectLimit($q, 10);
$ss = "<div align='left'> $remark_add</div>";
$ss = "<table width=700 border=0 cellspacing=0 cellpadding=0 align=center height=0><tr><td ><font color='#990000'>&nbsp;&nbsp;电话备注记录($telno)&nbsp;&nbsp;</font></td></tr></table><table " . LIST_TBL_STYLE . "><tr align=center bgcolor=#F7F4E8><td width=5%>类型</td><td width=10%>房源编号</td><td width=10%>房源地址</td><td width=10%>联系人</td><td width=10%>当时状态</td><td width=25%>电话备注</td><td width=15%>更新时间</td><td width=10%>操作员</td><td >操作</td></tr>";
$ss = "<table width=700 border=0 cellspacing=0 cellpadding=0 align=center height=0><tr><td ><font color='#990000'>&nbsp;&nbsp;�绰��ע��¼($telno)&nbsp;&nbsp;</font></td></tr></table><table " . LIST_TBL_STYLE . "><tr align=center bgcolor=#F7F4E8><td width=5%>����</td><td width=10%>��Դ���</td><td width=10%>��Դ��ַ</td><td width=10%>��ϵ��</td><td width=10%>��ʱ״̬</td><td width=25%>�绰��ע</td><td width=15%>����ʱ��</td><td width=10%>����Ա</td><td >����</td></tr>";
while ($row = $rs->FetchRow()) {
$updatetime = date("Ymd H:i", $row["updatetime"]); //登记时间
$esta = tony_flag2name($row["esta"], $house['esta']); //前状态
$updatetime = date("Ymd H:i", $row["updatetime"]); //�Ǽ�ʱ��
$esta = tony_flag2name($row["esta"], $house['esta']); //��ǰ״̬
$address = csubstr2($row[address], 20);
$act = "<a href='telno_note.php?tbl=$row[tbl]&rowid=$row[rowid]&telno=$row[telno]&esta=$row[esta]' target='_blank'>改</a> <a href='telno_note.php?action=del&id=$row[id]' target='_blank' onclick='if (!confirm(\\\"确定要删除该记录吗?\\\"))return false;'>删</a>";
$act = "<a href='telno_note.php?tbl=$row[tbl]&rowid=$row[rowid]&telno=$row[telno]&esta=$row[esta]' target='_blank'>��</a> <a href='telno_note.php?action=del&id=$row[id]' target='_blank' onclick='if (!confirm(\\\"ȷ��Ҫɾ���ü�¼��\\\"))return false;'>ɾ</a>";
$ss.="<tr><td>$row[tbl]</td><td>$row[rowid]</td><td align=left><span title='$row[address]'>$address</span></td><td>$row[contactor]</td><td>$esta</td><td><font color=blue>" . addslashes($row[note]) . "</font></td><td>$updatetime</td><td>$row[operator]</td><td>$act</td></tr>";
}
......@@ -296,7 +296,8 @@ function telnotelist($telno) {
return $ss;
}
function broker_sync_refresh() {//同步刷新规则
function broker_sync_refresh() {//ͬ��ˢ�¹���
return false;
GLOBAL $db;
$q = "select uid,postlimit,refresh from broker where valid_flag=1 order by uid asc";
......@@ -338,7 +339,7 @@ function ischecked($args) {
}
}
//中间层刷新房源 2011-12-9上
//�м��ˢ�·�Դ 2011-12-9��
function refresh_housebymid($uid, $tpl, $id) {
global $midwork_refreshurl,$conf_city;
$bd = @file_get_contents($midwork_refreshurl . "&app=" . $tpl . "&uid=" . $uid . "&hid=" . $id);
......@@ -351,7 +352,7 @@ function tony_view2($pic, $picPath, $picid = '', $blockid = '') {
GLOBAL $db;
$url = $picPath;
$ss = $picPath ? "<a href='$url' title='<img src=$url width=200 height=200 />'>查看</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">删除</a>&nbsp;" . $block . "" : "";
$ss = $picPath ? "<a href='$url' title='<img src=$url width=200 height=200 />'>�鿴</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">ɾ��</a>&nbsp;" . $block . "" : "";
return $ss;
}
}
......@@ -359,7 +360,7 @@ if(!function_exists('tony_view')) {
function tony_view($pic, $picPath) {
//$url=PUBURL.$picPath;
$url = $picPath;
$ss = $picPath ? "<a href='$url' target='_blank' title='<img src=$url width=200 height=200 />' >查看</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">删除</a>" : "";
$ss = $picPath ? "<a href='$url' target='_blank' title='<img src=$url width=200 height=200 />' >�鿴</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">ɾ��</a>" : "";
return $ss;
}
}
......@@ -410,7 +411,7 @@ function agent_actionlog($tbl, $rowid, $msg) {
$ss["uid"] = $_SESSION[$web_auth]["uid"];
$ss["infotype"] = $infotype;
$ss["tbl"] = $tbl;
$ss["msg"] = $msg; //0:删除 1:增加 2:刷新
$ss["msg"] = $msg; //0:ɾ�� 1:���� 2:ˢ��
$ss["y"] = date('Y');
$ss["m"] = date('m');
$ss["d"] = date('d');
......@@ -422,7 +423,7 @@ function agent_actionlog($tbl, $rowid, $msg) {
$q = insert_sql('log_agent', $ss);
$db->Execute($q);
//新版统计2011-10-55
//�°�ͳ��2011-10-55
if ($_SESSION[$web_auth]["agentcode"] == 'B000' && $msg == 2) {
$ymd = date("Y-m-d");
......@@ -462,7 +463,7 @@ function tony_str_replace($arr, $str) {
}
if(!function_exists('tony_fileupload_add')) {
function tony_fileupload_add($position) {
$ss = "<input type=file name='$position'>&nbsp;图片描述:<input type='text' size=20 name='{$position}_title' id='{$position}_title'>";
$ss = "<input type=file name='$position'>&nbsp;ͼƬ����:<input type='text' size=20 name='{$position}_title' id='{$position}_title'>";
return $ss;
}
}
......@@ -474,7 +475,7 @@ function tony_fileupload_modify($tbl, $rowid, $position) {
$row = $db->GetRow("select * from $uploadtbl where tbl='$tbl' and rowid='$rowid' and position='$position'");
$ss = "<input type=file name='$position'>&nbsp;图片描述:<input type='text' size=20 name='{$position}_title' id='{$position}_title' value='$row[title]'>&nbsp;<span id='{$position}_control'>" . tony_view($position, $row[filename]) . "</span>";
$ss = "<input type=file name='$position'>&nbsp;ͼƬ����:<input type='text' size=20 name='{$position}_title' id='{$position}_title' value='$row[title]'>&nbsp;<span id='{$position}_control'>" . tony_view($position, $row[filename]) . "</span>";
return $ss;
}
......@@ -563,24 +564,24 @@ function csubstr($str_cut, $length = 30, $p = 0) {
if(!function_exists('qstr')) {
function qstr($ss, $db_type = "mysql", $slash_flag = true) {
/*
stripslashes是用于去掉多余的slash,大多是form提交时产生的,他们不能存入数据库)
无论是那种数据库,存进去的数据都是没有slash的。例如 abc'def"fff\hhh
查询条件为'
mssql:则查询语句需要写成select * from test where col_1 like '%''%'
mysql:则查询语句需要写成select * from test where col_1 like '%\'%'
查询条件为"
mssql:则查询语句需要写成select * from test where col_1 like '%"%'
mysql:则查询语句需要写成select * from test where col_1 like '%\"%'
就是说mysql查询时需要addslashes,mssql需要将'转化为''
如果 是post过来的数据,会自动加上slash,因此无论mssql或是mysql都需要先stripslashes
如果不是post过来的数据,不会加上slash ,因此无需stripslashes
这也就是$slash_flag开关的用途:post过来的数据$slashes_flag=true,其他=false
(mysql的addslashes和mssql的''都是为了查询不出错)
stripslashes������ȥ�������slash�������form�ύʱ�����ģ����Dz��ܴ������ݿ�)
�������������ݿ⣬���ȥ�����ݶ���û��slash�ġ����� abc'def"fff\hhh
��ѯ����Ϊ'
mssql�����ѯ�����Ҫд��select * from test where col_1 like '%''%'
mysql�����ѯ�����Ҫд��select * from test where col_1 like '%\'%'
��ѯ����Ϊ"
mssql�����ѯ�����Ҫд��select * from test where col_1 like '%"%'
mysql�����ѯ�����Ҫд��select * from test where col_1 like '%\"%'
Ҳ����˵mysql��ѯʱ��Ҫaddslashes��mssql��Ҫ��'ת��Ϊ''
��� ��post���������ݣ����Զ�����slash���������mssql����mysql����Ҫ��stripslashes
�������post���������ݣ��������slash ���������stripslashes
��Ҳ����$slash_flag���ص���;:post����������$slashes_flag=true,����=false
(mysql��addslashes��mssql��''����Ϊ�˲�ѯ������)
2001.8.1
slash_flag参数已经去掉,because of stripslash_vars()
stripslash_vars()将所有post,get过来的变量做了stripslashes处理,所以此处无需再strip
slash_flag�����Ѿ�ȥ����because of stripslash_vars()
stripslash_vars()������post,get�����ı�������stripslashes�������Դ˴�������strip
*/
$replaceQuote["mssql"] = "''";
$replaceQuote["ibase"] = "\'";
......@@ -591,24 +592,24 @@ function qstr($ss, $db_type = "mysql", $slash_flag = true) {
if ($db_type == "mssql")
return str_replace("'", $replaceQuote[$db_type], $ss);
if ($db_type == "mysql") //针对mysql数据库,addslashes是用于sql查询不出错,相当于replaceQuote的操作
if ($db_type == "mysql") //���mysql���ݿ⣬addslashes������sql��ѯ�������൱��replaceQuote�IJ���
return addslashes($ss);
}
}
if(!function_exists('no_html_str')) {
function no_html_str($str) {//用于数据库中读出(此时是没有slash),显
function no_html_str($str) {//�������ݿ��ж���(��ʱ��û��slash)����ʾ
$str = nl2br(htmlspecialchars($str));
return $str;
}
}
//format_str_1("abc",4) 返回 &nbsp;abc
//format_str_1("a",4) 返回 &nbsp;&nbsp;&nbsp;a
//format_str_1("abc",4) ���� &nbsp;abc
//format_str_1("a",4) ���� &nbsp;&nbsp;&nbsp;a
if(!function_exists('fmt_str_1')) {
function fmt_str_1($str, $strlen_total = 2, $fill_in = "&nbsp;", $direction = "before") {
$str = strval(trim($str));
for ($i = strlen($str); $i < $strlen_total; $i++)
if ($direction == "before") //确定是在前面(before)加,还是在后面(after)加 //2001.10.9修改
if ($direction == "before") //ȷ������ǰ��(before)�ӣ������ں���(after)�� //2001.10.9�޸�
$str = $fill_in . $str;
else
$str = $str . $fill_in;
......@@ -661,7 +662,7 @@ function arraytosql($array) {
}
/**
* getFeatureArr 获取房源特色数组
* getFeatureArr ��ȡ��Դ��ɫ����
*
* @param str $tbl
* @return array
......@@ -702,7 +703,7 @@ function getFeatureArr($tbl = 'sell')
}
/**
* getHouseFeature 获取房源特
* getHouseFeature ��ȡ��Դ��ɫ
*
* @param str $feature
* @param str $tbl
......@@ -744,7 +745,7 @@ function getHouseFeature($feature, $tbl = 'sell')
}
}
if(!function_exists('insert_sql')) {
function insert_sql($tablename,$field,$db_type="mysql") { //2001.12.27 修改 (加了$db_type参数)
function insert_sql($tablename,$field,$db_type="mysql") { //2001.12.27 �޸� (����$db_type����)
for ($i=1;$i<=count($field);$i++) {
if ($i==1)$ss1 =key($field) ;
else $ss1.=",".key($field) ;
......@@ -763,13 +764,13 @@ if(!function_exists('insert_sql')) {
}
}
/*
数据库操作函数集合 by zain
文件名:func_sql.php
创建日期:2011.3.7
更改日期:2011.3.7
���ݿ������������ by zain
�����func_sql.php
�������ڣ�2011.3.7
�������ڣ�2011.3.7
*/
if(!function_exists('update_sql')) {
function update_sql($tablename,$field,$sswhere="",$db_type="mysql") {//2001.12.27 修改 (加了$db_type参数)
function update_sql($tablename,$field,$sswhere="",$db_type="mysql") {//2001.12.27 �޸� (����$db_type����)
for ($i=1;$i<=count($field);$i++) {
if ($i==1) $ss =" ".key($field)."='".qstr($field[key($field)],$db_type)."' ";
else $ss.=",".key($field)."='".qstr($field[key($field)],$db_type)."' ";
......@@ -782,7 +783,7 @@ if(!function_exists('insert_sql')) {
}
//图片上传
//ͼƬ�ϴ�
if(!function_exists('common_file_upload')) {
function common_file_upload($fileName, $watermark = false, $resize = false, $width = 640, $height = 480, $swidth = 120, $sheight = 90, $maxsize = "2048")
{
......@@ -814,7 +815,7 @@ function common_file_upload($fileName, $watermark = false, $resize = false, $wid
}
if ($uf->upload() == "success") {
return $resize ? $uf->getResizeImageURL() : $uf->getSaveFileURL(); //图片
return $resize ? $uf->getResizeImageURL() : $uf->getSaveFileURL(); //ͼƬ��ַ
} else {
return false;
}
......@@ -836,9 +837,9 @@ if(!function_exists('curl_get_contents'))
}
}
/**
* 发送短消
* @param string $mobile 电话号码
* @param string $msg 消息内容
* ���Ͷ���Ϣ
* @param string $mobile �绰����
* @param string $msg ��Ϣ����
* @return $msg
*/
if(!function_exists('sendsms'))
......@@ -849,7 +850,7 @@ if(!function_exists('sendsms'))
}
}
//产生随机数函数
//�������������
if(!function_exists('random'))
{
function random($length) {
......@@ -880,10 +881,10 @@ if(!function_exists('curl_get_contents'))
}
}
/**
* js弹窗函数
* @param string $tip 弹窗消
* @param int $sty 返回类型
* @param string $href 返回地
* js��������
* @param string $tip ������Ϣ
* @param int $sty ��������
* @param string $href ���ص�ַ
* @return $msg
*/
if(!function_exists('js_alert'))
......
<?php
//函数集合
//��������
if(!function_exists('log_broker_credit')) {
function log_broker_credit($uid, $operation, $kind) {
GLOBAL $db;
......@@ -29,7 +29,7 @@ function log_agent_credit($uid, $operation, $kind) {
$db->Execute($q);
}
}
//写
//д��־
if(!function_exists('actionlog')) {
function actionlog($tbl, $rowid, $msg) {
GLOBAL $db, $web_auth;
......@@ -48,9 +48,9 @@ function actionlog($tbl, $rowid, $msg) {
}
/**
* 经纪人账号操作日志记
* �������˺Ų�����־��¼
*
* @param array 经纪人信
* @param array ��������Ϣ
*/
if(!function_exists('brokeroperatorlog')) {
function brokeroperatorlog($data) {
......@@ -65,7 +65,7 @@ function brokeroperatorlog($data) {
$db->Execute($q);
}
}
//取IP
//��ȡIP
if(!function_exists('GetIP')) {
function GetIP() {
......@@ -98,7 +98,7 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
$td_width = "width=" . floor(100 / $td_num) . "%";
$blank_i = ceil(count($option_arr) / $td_num) * $td_num - count($option_arr);
for ($i = 0; $i < $blank_i; $i++)
$option_arr[] = "";//补全使之成为整数
$option_arr[] = "";//��ȫʹ֮��Ϊ����
$str = "<table align=center border=0 cellspacing=0 width=100%> \n";
$i = 1;
......@@ -122,7 +122,7 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
$td_width = "width=" . floor(100 / $td_num) . "%";
$blank_i = ceil(count($option_arr) / $td_num) * $td_num - count($option_arr);
for ($i = 0; $i < $blank_i; $i++)
$option_arr[] = "";//补全使之成为整数
$option_arr[] = "";//��ȫʹ֮��Ϊ����
$str = "<table align=center border=0 cellspacing=0 width=100%> \n";
$i = 1;
......@@ -145,7 +145,7 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
$td_width = "width=" . floor(100 / $td_num) . "%";
$blank_i = ceil(count($option_arr) / $td_num) * $td_num - count($option_arr);
for ($i = 0; $i < $blank_i; $i++)
$option_arr[] = "";//补全使之成为整数
$option_arr[] = "";//��ȫʹ֮��Ϊ����
$str = "<table align=center border=0 cellspacing=0 width=100%> \n";
$i = 1;
......@@ -167,14 +167,14 @@ function tonyForm($tag, $name, $option_arr, $value = '', $td_num = 1, $validate
}
}
if(!function_exists('create_htmlable')) {
function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=''){//创建html标
//name标签名称|label标签类型|value标签的值(当为checkbox时为数组)|val主要用于radio和checkbox
function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=''){//����html��ǩ
//name��ǩ����|label��ǩ����|value��ǩ��ֵ(��ΪcheckboxʱΪ����)|val��Ҫ����radio��checkbox
$html = '';
if($class) $cls = 'class="'.$class.'"';
if($style) $sty = 'style="'.$style.'"';
if($name) $nam = 'name="'.$name.'"';
if($label=='text' || $label=='password'){//文本框
if($label=='text' || $label=='password'){//�ı���
if($name) $id = 'id="'.$name.'"';
$html = '<input '.$cls.' type="'.$label.'" '.$nam.' '.$id.' value="'.$value.'" '.$sty.' '.$js.'>';
}elseif($label=='radio'){//radio
......@@ -191,7 +191,7 @@ function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=
$html.=' <input type="'.$label.'" '.$nam.' '.$checked.' value="'.$key.'" '.$sty.' '.$js.'>'.$item;
}
}
}elseif($label=='select'){//下拉框
}elseif($label=='select'){//������
if(is_array($val)){
if($name) $id = 'id="'.$name.'"';
$html.='<select '.$nam.' '.$id.' '.$sty.' '.$js.'>';
......@@ -209,17 +209,17 @@ function create_htmlable($name,$label,$value='',$val='',$class='',$style='',$js=
if(!function_exists('ctrl_select')) {
function ctrl_select($opt_para, $ctrl_name, $ctrl_value, $style_ext = "class=flat1") {
/** 2002.03.05
ctrl_select 函数参数说明
@param [opt_para] : opt_para是一个数组,元素含义如下
[opt_arr] 下拉框选项的数组,可以是简单数组,也可以是关联数组
[field_key] 如果是关联数组,field_key表示, 下拉框的key 出自关联数组的哪一个field,为空表示出自简单数组的key
[field_value]如果是关联数组,field_value表示,下拉框的value出自关联数组的哪一个field,为空表示出自简单数组的value
@param [ctrl_name] : select控件的名称
@param [ctrl_value] : select控件选择的值
@param [style_ext] : 扩充的样式,可以是样式或js
返回select的string
ctrl_select ��������˵��
@param [opt_para] : opt_para��һ�����飬Ԫ�غ�������
[opt_arr] ������ѡ������飬�����Ǽ����飬Ҳ�����ǹ�������
[field_key] ����ǹ������飬field_key��ʾ�� �������key ���Թ����������һ��field��Ϊ�ձ�ʾ���Լ������key
[field_value]����ǹ������飬field_value��ʾ���������value���Թ����������һ��field��Ϊ�ձ�ʾ���Լ������value
@param [ctrl_name] : select�ؼ�������
@param [ctrl_value] : select�ؼ�ѡ���ֵ
@param [style_ext] : �������ʽ����������ʽ��js
����select��string
* */
// 1.重新构建数组,将关联数组化为简单数组
// 1.���¹������飬���������黯Ϊ������
$old_opt_arr = (is_array($opt_para[opt_arr])) ? ($opt_para[opt_arr]) : (array());
FOR ($opt_arr = array(), reset($old_opt_arr), $i = 0; $i < count($old_opt_arr); $i++) {
$key = key($old_opt_arr);
......@@ -229,7 +229,7 @@ function ctrl_select($opt_para, $ctrl_name, $ctrl_value, $style_ext = "class=fla
next($old_opt_arr);
}
// 2.生成
// 2.����
$ss = "<select name=\"" . $ctrl_name . "\" " . $style_ext . ">\n";
for (reset($opt_arr), $i = 1; $i <= count($opt_arr); $i++) {
$key = key($opt_arr);
......@@ -285,13 +285,13 @@ function telnotelist($telno) {
$rs = $db->SelectLimit($q, 10);
$ss = "<div align='left'> $remark_add</div>";
$ss = "<table width=700 border=0 cellspacing=0 cellpadding=0 align=center height=0><tr><td ><font color='#990000'>&nbsp;&nbsp;电话备注记录($telno)&nbsp;&nbsp;</font></td></tr></table><table " . LIST_TBL_STYLE . "><tr align=center bgcolor=#F7F4E8><td width=5%>类型</td><td width=10%>房源编号</td><td width=10%>房源地址</td><td width=10%>联系人</td><td width=10%>当时状态</td><td width=25%>电话备注</td><td width=15%>更新时间</td><td width=10%>操作员</td><td >操作</td></tr>";
$ss = "<table width=700 border=0 cellspacing=0 cellpadding=0 align=center height=0><tr><td ><font color='#990000'>&nbsp;&nbsp;�绰��ע��¼($telno)&nbsp;&nbsp;</font></td></tr></table><table " . LIST_TBL_STYLE . "><tr align=center bgcolor=#F7F4E8><td width=5%>����</td><td width=10%>��Դ���</td><td width=10%>��Դ��ַ</td><td width=10%>��ϵ��</td><td width=10%>��ʱ״̬</td><td width=25%>�绰��ע</td><td width=15%>����ʱ��</td><td width=10%>����Ա</td><td >����</td></tr>";
while ($row = $rs->FetchRow()) {
$updatetime = date("Ymd H:i", $row["updatetime"]); //登记时间
$esta = tony_flag2name($row["esta"], $house['esta']); //前状态
$updatetime = date("Ymd H:i", $row["updatetime"]); //�Ǽ�ʱ��
$esta = tony_flag2name($row["esta"], $house['esta']); //��ǰ״̬
$address = csubstr2($row[address], 20);
$act = "<a href='telno_note.php?tbl=$row[tbl]&rowid=$row[rowid]&telno=$row[telno]&esta=$row[esta]' target='_blank'>改</a> <a href='telno_note.php?action=del&id=$row[id]' target='_blank' onclick='if (!confirm(\\\"确定要删除该记录吗?\\\"))return false;'>删</a>";
$act = "<a href='telno_note.php?tbl=$row[tbl]&rowid=$row[rowid]&telno=$row[telno]&esta=$row[esta]' target='_blank'>��</a> <a href='telno_note.php?action=del&id=$row[id]' target='_blank' onclick='if (!confirm(\\\"ȷ��Ҫɾ���ü�¼��\\\"))return false;'>ɾ</a>";
$ss.="<tr><td>$row[tbl]</td><td>$row[rowid]</td><td align=left><span title='$row[address]'>$address</span></td><td>$row[contactor]</td><td>$esta</td><td><font color=blue>" . addslashes($row[note]) . "</font></td><td>$updatetime</td><td>$row[operator]</td><td>$act</td></tr>";
}
......@@ -304,9 +304,9 @@ function telnotelist($telno) {
}
if(!function_exists('broker_sync_refresh')) {
function broker_sync_refresh() {//同步刷新规则
function broker_sync_refresh() {//ͬ��ˢ�¹���
GLOBAL $db;
return false;
$q = "select uid,postlimit,refresh from broker where valid_flag=1 order by uid asc";
$broker = $db->GetAll($q);
......@@ -349,7 +349,7 @@ function ischecked($args) {
}
}
//中间层刷新房源 2011-12-9上
//�м��ˢ�·�Դ 2011-12-9��
if(!function_exists('refresh_housebymid')) {
function refresh_housebymid($uid, $tpl, $id) {
global $midwork_refreshurl,$conf_city;
......@@ -363,7 +363,7 @@ function tony_view2($pic, $picPath, $picid = '', $blockid = '') {
GLOBAL $db;
$url = $picPath;
$ss = $picPath ? "<a href='$url' title='<img src=$url width=200 height=200 />'>查看</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">删除</a>&nbsp;" . $block . "" : "";
$ss = $picPath ? "<a href='$url' title='<img src=$url width=200 height=200 />'>�鿴</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">ɾ��</a>&nbsp;" . $block . "" : "";
return $ss;
}
}
......@@ -371,7 +371,7 @@ if(!function_exists('tony_view')) {
function tony_view($pic, $picPath) {
//$url=PUBURL.$picPath;
$url = $picPath;
$ss = $picPath ? "<a href='$url' target='_blank' title='<img src=$url width=200 height=200 />' >查看</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">删除</a>" : "";
$ss = $picPath ? "<a href='$url' target='_blank' title='<img src=$url width=200 height=200 />' >�鿴</a>&nbsp;&nbsp;<a href=$url onclick=\"return delpic('$pic');\">ɾ��</a>" : "";
return $ss;
}
}
......@@ -422,7 +422,7 @@ function agent_actionlog($tbl, $rowid, $msg) {
$ss["uid"] = $_SESSION[$web_auth]["uid"];
$ss["infotype"] = $infotype;
$ss["tbl"] = $tbl;
$ss["msg"] = $msg; //0:删除 1:增加 2:刷新
$ss["msg"] = $msg; //0:ɾ�� 1:���� 2:ˢ��
$ss["y"] = date('Y');
$ss["m"] = date('m');
$ss["d"] = date('d');
......@@ -434,7 +434,7 @@ function agent_actionlog($tbl, $rowid, $msg) {
$q = insert_sql('log_agent', $ss);
$db->Execute($q);
//新版统计2011-10-55
//�°�ͳ��2011-10-55
if ($_SESSION[$web_auth]["agentcode"] == 'B000' && $msg == 2) {
$ymd = date("Y-m-d");
......@@ -474,7 +474,7 @@ function tony_str_replace($arr, $str) {
}
if(!function_exists('tony_fileupload_add')) {
function tony_fileupload_add($position) {
$ss = "<input type=file name='$position'>&nbsp;图片描述:<input type='text' size=20 name='{$position}_title' id='{$position}_title'>";
$ss = "<input type=file name='$position'>&nbsp;ͼƬ����:<input type='text' size=20 name='{$position}_title' id='{$position}_title'>";
return $ss;
}
}
......@@ -486,7 +486,7 @@ function tony_fileupload_modify($tbl, $rowid, $position) {
$row = $db->GetRow("select * from $uploadtbl where tbl='$tbl' and rowid='$rowid' and position='$position'");
$ss = "<input type=file name='$position'>&nbsp;图片描述:<input type='text' size=20 name='{$position}_title' id='{$position}_title' value='$row[title]'>&nbsp;<span id='{$position}_control'>" . tony_view($position, $row[filename]) . "</span>";
$ss = "<input type=file name='$position'>&nbsp;ͼƬ����:<input type='text' size=20 name='{$position}_title' id='{$position}_title' value='$row[title]'>&nbsp;<span id='{$position}_control'>" . tony_view($position, $row[filename]) . "</span>";
return $ss;
}
......@@ -578,24 +578,24 @@ function csubstr($str_cut, $length = 30, $p = 0) {
if(!function_exists('qstr')) {
function qstr($ss, $db_type = "mysql", $slash_flag = true) {
/*
stripslashes是用于去掉多余的slash,大多是form提交时产生的,他们不能存入数据库)
无论是那种数据库,存进去的数据都是没有slash的。例如 abc'def"fff\hhh
查询条件为'
mssql:则查询语句需要写成select * from test where col_1 like '%''%'
mysql:则查询语句需要写成select * from test where col_1 like '%\'%'
查询条件为"
mssql:则查询语句需要写成select * from test where col_1 like '%"%'
mysql:则查询语句需要写成select * from test where col_1 like '%\"%'
就是说mysql查询时需要addslashes,mssql需要将'转化为''
如果 是post过来的数据,会自动加上slash,因此无论mssql或是mysql都需要先stripslashes
如果不是post过来的数据,不会加上slash ,因此无需stripslashes
这也就是$slash_flag开关的用途:post过来的数据$slashes_flag=true,其他=false
(mysql的addslashes和mssql的''都是为了查询不出错)
stripslashes������ȥ�������slash�������form�ύʱ�����ģ����Dz��ܴ������ݿ�)
�������������ݿ⣬���ȥ�����ݶ���û��slash�ġ����� abc'def"fff\hhh
��ѯ����Ϊ'
mssql�����ѯ�����Ҫд��select * from test where col_1 like '%''%'
mysql�����ѯ�����Ҫд��select * from test where col_1 like '%\'%'
��ѯ����Ϊ"
mssql�����ѯ�����Ҫд��select * from test where col_1 like '%"%'
mysql�����ѯ�����Ҫд��select * from test where col_1 like '%\"%'
Ҳ����˵mysql��ѯʱ��Ҫaddslashes��mssql��Ҫ��'ת��Ϊ''
��� ��post���������ݣ����Զ�����slash���������mssql����mysql����Ҫ��stripslashes
�������post���������ݣ��������slash ���������stripslashes
��Ҳ����$slash_flag���ص���;:post����������$slashes_flag=true,����=false
(mysql��addslashes��mssql��''����Ϊ�˲�ѯ������)
2001.8.1
slash_flag参数已经去掉,because of stripslash_vars()
stripslash_vars()将所有post,get过来的变量做了stripslashes处理,所以此处无需再strip
slash_flag�����Ѿ�ȥ����because of stripslash_vars()
stripslash_vars()������post,get�����ı�������stripslashes�������Դ˴�������strip
*/
$replaceQuote["mssql"] = "''";
$replaceQuote["ibase"] = "\'";
......@@ -606,24 +606,24 @@ function qstr($ss, $db_type = "mysql", $slash_flag = true) {
if ($db_type == "mssql")
return str_replace("'", $replaceQuote[$db_type], $ss);
if ($db_type == "mysql") //针对mysql数据库,addslashes是用于sql查询不出错,相当于replaceQuote的操作
if ($db_type == "mysql") //���mysql���ݿ⣬addslashes������sql��ѯ�������൱��replaceQuote�IJ���
return addslashes($ss);
}
}
if(!function_exists('no_html_str')) {
function no_html_str($str) {//用于数据库中读出(此时是没有slash),显
function no_html_str($str) {//�������ݿ��ж���(��ʱ��û��slash)����ʾ
$str = nl2br(htmlspecialchars($str));
return $str;
}
}
//format_str_1("abc",4) 返回 &nbsp;abc
//format_str_1("a",4) 返回 &nbsp;&nbsp;&nbsp;a
//format_str_1("abc",4) ���� &nbsp;abc
//format_str_1("a",4) ���� &nbsp;&nbsp;&nbsp;a
if(!function_exists('fmt_str_1')) {
function fmt_str_1($str, $strlen_total = 2, $fill_in = "&nbsp;", $direction = "before") {
$str = strval(trim($str));
for ($i = strlen($str); $i < $strlen_total; $i++)
if ($direction == "before") //确定是在前面(before)加,还是在后面(after)加 //2001.10.9修改
if ($direction == "before") //ȷ������ǰ��(before)�ӣ������ں���(after)�� //2001.10.9�޸�
$str = $fill_in . $str;
else
$str = $str . $fill_in;
......@@ -676,7 +676,7 @@ function arraytosql($array) {
}
/**
* getFeatureArr 获取房源特色数组
* getFeatureArr ��ȡ��Դ��ɫ����
*
* @param str $tbl
* @return array
......@@ -717,7 +717,7 @@ function getFeatureArr($tbl = 'sell')
}
/**
* getHouseFeature 获取房源特
* getHouseFeature ��ȡ��Դ��ɫ
*
* @param str $feature
* @param str $tbl
......@@ -759,7 +759,7 @@ function getHouseFeature($feature, $tbl = 'sell')
}
}
if(!function_exists('insert_sql')) {
function insert_sql($tablename,$field,$db_type="mysql") { //2001.12.27 修改 (加了$db_type参数)
function insert_sql($tablename,$field,$db_type="mysql") { //2001.12.27 �޸� (����$db_type����)
for ($i=1;$i<=count($field);$i++) {
if ($i==1)$ss1 =key($field) ;
else $ss1.=",".key($field) ;
......@@ -778,13 +778,13 @@ if(!function_exists('insert_sql')) {
}
}
/*
数据库操作函数集合 by zain
文件名:func_sql.php
创建日期:2011.3.7
更改日期:2011.3.7
���ݿ������������ by zain
�����func_sql.php
�������ڣ�2011.3.7
�������ڣ�2011.3.7
*/
if(!function_exists('update_sql')) {
function update_sql($tablename,$field,$sswhere="",$db_type="mysql") {//2001.12.27 修改 (加了$db_type参数)
function update_sql($tablename,$field,$sswhere="",$db_type="mysql") {//2001.12.27 �޸� (����$db_type����)
for ($i=1;$i<=count($field);$i++) {
if ($i==1) $ss =" ".key($field)."='".qstr($field[key($field)],$db_type)."' ";
else $ss.=",".key($field)."='".qstr($field[key($field)],$db_type)."' ";
......@@ -797,7 +797,7 @@ if(!function_exists('insert_sql')) {
}
//图片上传
//ͼƬ�ϴ�
if(!function_exists('common_file_upload')) {
function common_file_upload($fileName, $watermark = false, $resize = false, $width = 640, $height = 480, $swidth = 120, $sheight = 90, $maxsize = "2048")
{
......@@ -829,7 +829,7 @@ function common_file_upload($fileName, $watermark = false, $resize = false, $wid
}
if ($uf->upload() == "success") {
return $resize ? $uf->getResizeImageURL() : $uf->getSaveFileURL(); //图片
return $resize ? $uf->getResizeImageURL() : $uf->getSaveFileURL(); //ͼƬ��ַ
} else {
return false;
}
......@@ -851,9 +851,9 @@ if(!function_exists('curl_get_contents'))
}
}
/**
* 发送短消
* @param string $mobile 电话号码
* @param string $msg 消息内容
* ���Ͷ���Ϣ
* @param string $mobile �绰����
* @param string $msg ��Ϣ����
* @return $msg
*/
if(!function_exists('sendsms'))
......@@ -864,7 +864,7 @@ if(!function_exists('sendsms'))
}
}
//产生随机数函数
//�������������
if(!function_exists('random'))
{
function random($length) {
......@@ -895,10 +895,10 @@ if(!function_exists('curl_get_contents'))
}
}
/**
* js弹窗函数
* @param string $tip 弹窗消
* @param int $sty 返回类型
* @param string $href 返回地
* js��������
* @param string $tip ������Ϣ
* @param int $sty ��������
* @param string $href ���ص�ַ
* @return $msg
*/
if(!function_exists('js_alert'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment