uchome二次开发必须知道的通用方法

来源:互联网 发布:淘宝网手机库计算比例 编辑:程序博客网 时间:2024/05/24 07:43

了解一下Uchome的通用方法将对我们二次开发起到很大帮助。

引用文件:function_common.php

001 //SQL ADDSLASHES
002 function saddslashes($string)   return $string;
003
004 //取消HTML代码
005 function shtmlspecialchars($string)  return $string;
006
007 //字符串解密加密
008 function authcode($string, $operation = ‘DECODE’, $key = ”, $expiry = 0)
009
010 //清空cookie
011 function clearcookie()
012
013 //cookie设置
014 function ssetcookie($var, $value, $life=0)
015
016 //数据库连接
017 function dbconnect()
018
019 //获取在线IP
020 function getonlineip($format=0)
021
022 //判断当前用户登录状态
023 function checkauth()
024
025 //获取用户app列表
026 function getuserapp($uid=0)
027
028 //获取到表名
029 function tname($name)
030
031 //对话框
032 function showmessage($msgkey, $url_forward=”, $second=1, $values=array())
033
034 //判断提交是否正确
035 function submitcheck($var)
036
037 //添加数据
038 function inserttable($tablename, $insertsqlarr, $returnid=0, $replace = false, $silent=0)  return insert_id;
039
040 //更新数据
041 function updatetable($tablename, $setsqlarr, $wheresqlarr, $silent=0)
042
043 //获取用户空间信息
044 function getspace($key, $indextype=’uid’)
045
046 //获取当前用户信息
047 function getmember()
048
049 //检查隐私
050 function ckprivacy($type, $feedmode=0)
051
052 //检查APP隐私
053 function app_ckprivacy($privacy)
054
055
056 //获取用户组
057 function getgroupid($credit, $gid=0)
058
059 //检查权限
060 function checkperm($permtype)
061
062 //写运行日志
063 function runlog($file, $log, $halt=0)
064
065 //获取字符串
066 function getstr($string, $length, $in_slashes=0, $out_slashes=0, $censor=0, $bbcode=0, $html=0)
067
068 //时间格式化
069 function sgmdate($dateformat, $timestamp=”, $format=0)
070
071 //字符串时间化
072 function sstrtotime($string)
073
074 //分页
075 function multi($num, $perpage, $curpage, $mpurl)
076
077 //ob
078 function obclean()
079
080 //模板调用
081 function template($name)
082
083 //子模板更新检查
084 function subtplcheck($subfiles, $mktime, $tpl)
085
086 //模块
087 function block($param)
088
089 //获取数目
090 function getcount($tablename, $wherearr, $get=’COUNT(*)’)
091
092 //调整输出
093 function ob_out()
094
095 //rewrite链接
096 function rewrite_url($pre, $para)
097
098 //外链
099 function iframe_url($url)
100
101 //处理搜索关键字
102 function stripsearchkey($string)
103
104 //是否屏蔽二级域名
105 function isholddomain($domain)
106
107 //连接字符
108 function simplode($ids)
109
110
111 //显示进程处理时间
112 function debuginfo()
113
114 //格式化大小函数
115 function formatsize($size)
116
117 //获取文件内容
118 function sreadfile($filename)
119
120 //写入文件
121 function swritefile($filename, $writetext, $openmod=’w')
122
123 //产生随机字符
124 function random($length, $numeric = 0)
125
126 //判断字符串是否存在
127 function strexists($haystack, $needle)
128
129 //获取数据
130 function data_get($var, $isarray=0)
131
132 //更新数据
133 function data_set($var, $datavalue, $clean=0)
134
135 //检查站点是否关闭
136 function checkclose()
137
138 //站点链接
139 function getsiteurl()
140
141 //获取文件名后缀
142 function fileext($filename)
143
144 //积分
145 function creditrule($mode, $type)
146
147 //更新积分
148 function updatespacestatus($creditmode, $optype)
149
150 //去掉slassh
151 function sstripslashes($string)
152
153 //显示广告
154 function adshow($pagetype)
155
156 //编码转换
157 function siconv($str, $out_charset, $in_charset=”)
158
159 //获取用户数据
160 function getpassport($username, $password)
161
162 //用户操作时间间隔检查
163 function interval_check($type)
164
165 //处理上传图片连接
166 function mkpicurl($pic, $thumb=1)
167
168 //处理网络图片链接
169 function getpicurl($picurl, $maxlenth=’200′)
170
171 //处理积分星星
172 function getstar($credit)
173
174 //处理分页
175 function smulti($start, $perpage, $count, $url, $ajaxdiv=”)
176
177 //获取好友状态
178 function getfriendstatus($uid, $fuid)
179
180 //重新组建
181 function renum($array)
182
183 //检查定向
184 function ckfriend($invalue)
185
186 //整理feed
187 function mkfeed($feed, $actors=array())
188
189 //整理分享
190 function mkshare($share)
191
192 //ip访问允许
193 function ipaccess($ipaccess)
194
195 //ip访问禁止
196 function ipbanned($ipbanned)
197
198 //检查start
199 function ckstart($start, $perpage)
200
201 //处理头像
202 function avatar($uid, $size=’small’)
203
204 //检查是否登录
205 function checklogin()
206
207 //获得前台语言
208 function lang($key, $vars=array())
209
210 //获得后台语言
211 function cplang($key, $vars=array())
212
213 //语言替换
214 function lang_replace($text, $vars)
215
216 //获得用户组名
217 function getfriendgroup()
218
219 //截取链接
220 function sub_url($url, $length)
221
222 //获取用户名
223 function realname_set($uid, $username, $name=”, $namestatus=0)
224
225 //获取实名
226 function realname_get()

引用文件:function_cache.php
001 //更新配置文件
002 function config_cache($updatedata=true)
003
004 //更新用户组CACHE
005 function usergroup_cache()
006
007 //更新用户栏目缓存
008 function profilefield_cache()
009
010 //更新群组栏目缓存
011 function profield_cache()
012
013 //更新词语屏蔽
014 function censor_cache()
015
016 //更新积分规则
017 function creditrule_cache()
018
019 //更新广告缓存
020 function ad_cache()
021
022 //更新用户向导任务
023 function task_cache()
024
025 //更新模块
026 function block_cache()
027
028 //更新模板文件
029 function tpl_cache()
030
031 //更新模块缓存
032 function block_data_cache()
033
034 //更新应用名
035 function app_cache()
036
037 //递归清空目录
038 function deltreedir($dir)
039
040 //数组转换成字串
041 function arrayeval($array, $level = 0)
042
043 //写入
044 function cache_write($name, $var, $values)
045
046 function_cp.php
047 引用:
048
049 //保存图片
050 function pic_save($FILE, $albumid, $title ,$tid = 0)
051
052 //数据流保存,所有数据均为存放相册的所以写入的数据一定只能是图片
053 function stream_save($strdata, $albumid = 0, $fileext = ‘jpg’)
054
055 //创建相册
056 function album_creat($arr)
057
058 //获取上传路径
059 function getfilepath($fileext, $mkdir=false)
060
061 //获取目录
062 function sreaddir($dir, $extarr=array())
063
064 //检查邮箱是否有效
065 function isemail($email)
066
067 //获取相册封面图片
068 function getalbumpic($uid, $id)
069
070 //获取个人分类
071 function getclassarr($uid)
072
073 //获取相册
074 function getalbums($uid)
075
076 //事件发布
077 function feed_add($icon, $title_template=”, $title_data=array(), $body_template=”, $body_data=array(),
078
079 $body_general=”, $images=array(), $image_links=array(), $target_ids=”, $friend=”, $appid=UC_APPID,
080
081 $returnid=0, $system=0)
082
083 //分享发布
084 function share_add($type, $title_template, $body_template, $body_data, $body_general, $image=”,
085
086 $image_link=”)
087
088 //通知
089 function notification_add($uid, $type, $note, $returnid=0)
090
091 //更新好友状态
092 function friend_update($uid, $username, $fuid, $fusername, $op=’add’, $gid=0)
093
094 //更新好友缓存
095 function friend_cache($uid)
096
097 //检查验证码
098 function ckseccode($seccode)
099
100 //相册产生feed
101 function album_feed($albumid)
102
103 //更新隐私设置
104 function privacy_update()
105
106 //邀请好友
107 function invite_update($inviteid, $uid, $username, $m_uid, $m_username)
108
109 //获得邀请
110 function invite_get($uid, $code)
111
112 //实名认证
113 function ckrealname($type)
114
115 //邮件队列
116 function addmailcron($touid, $email, $subject, $message=”, $mailtype=”)
117
118 //检查头像是否上传
119 function ckavatar($uid)
120
121 //检查黑名单
122 function isblacklist($to_uid)

引用文件:function_admincp.php
01 //获取限制条件
02 function getwheres($intkeys, $strkeys, $randkeys, $likekeys, $pre=”)
03
04 //获取排序
05 function getorders($alloworders, $default, $pre=”)
06
07 //对话框
08 function cpmessage($msgkey, $url_forward=”, $second=1, $values=array())
09
10 //检查是否操作创始人
11 function ckfounder($uid)
12
13 //生成站点key
14 function mksitekey()
15
16 //统计数据
17 function getstatistics()
18
19 //日志
20 function admincp_log()
21 function_op.php    //帖子操作方法
22
23 //合并tag
24 function mergetag($tagids, $newtagid)
25
26 //锁定/开放tag
27 function closetag($tagids, $optype)
28
29 //合并mtag
30 function mergemtag($tagids, $newtagid)
31
32 //锁定/开放tag
33 function closemtag($tagids, $optype)
34
35 //话题精华
36 function digestthreads($tagid, $tids, $v)
37
38 //话题置顶
39 function topthreads($tagid, $tids, $v)
40 //模块解析通用方法
41 function_block.php
42
43 //处理模块
44 function block_batch($param)
45
46 //获取模块缓存
47 function block_get($cachekey)
48
49 //更新模块
50 function block_set($cachekey, $blockarr)
51
52 //字符串解析
53 function parseparameter($param)
54
55 //获取缓存分类名
56 function getcachedirname($cachekey, $ext=”)
57
58 //MD5规则取缓存名
59 function smd5($str)
60
61 //获取数量sql
62 function getcountsql($sqlstring, $rule, $tablename, $where)
63
64 //获取数量和查询语句
65 function getparamsql($paramarr)
66
67 function mksqltime($time)