首页 > Web开发 > 详细

discuz核心函数库function_core的函数注释

时间:2014-12-12 01:17:24      阅读:537      评论:0      收藏:0      [点我收藏+]

转:http://jancy.iteye.com/blog/1260834

Php代码  bubuko.com,布布扣
  1. /** 
  2.  * 系统错误处理 
  3.  * @param <type> $message 错误信息 
  4.  * @param <type> $show 是否显示信息 
  5.  * @param <type> $save 是否存入日志 
  6.  * @param <type> $halt 是否中断访问 
  7.  */  
  8. function system_error($message, $show = true, $save = true, $halt = true) {  
  9.     ......      
  10. }  
  11.   
  12. /** 
  13.  * 更新 session 
  14.  * @global <type> $_G 
  15.  * @staticvar boolean $updated 
  16.  * @param boolean $force 
  17.  * @return boolean 
  18.  */  
  19. function updatesession($force = false) {  
  20.     ......      
  21. }  
  22.   
  23. /** 
  24.  * 获取 microtime float 数值,为了兼容php4 
  25.  * @return <float> 
  26.  */  
  27. function dmicrotime() {  
  28.     ......      
  29. }  
  30.   
  31. /** 
  32.  * 设置全局 $_G 中的变量 
  33.  * @global <array> $_G 
  34.  * @param <string> $key 键 
  35.  * @param <string> $value 值 
  36.  * @param <mix> $group 组(准备废弃,尽量不用) 
  37.  * @return true 
  38.  * 
  39.  * @example 
  40.  * setglobal(‘test‘, 1); // $_G[‘test‘] = 1; 
  41.  * setglobal(‘config/test/abc‘) = 2; //$_G[‘config‘][‘test‘][‘abc‘] = 2; 
  42.  * 
  43.  */  
  44. function setglobal($key , $value, $group = null) {  
  45.     ......      
  46. }  
  47.   
  48. /** 
  49.  * 获取全局变量 $_G 当中的某个数值 
  50.  * @global  $_G 
  51.  * @param <type> $key 
  52.  * @param <type> $group 计划废弃的参数,不建议使用 
  53.  * @return <mix> 
  54.  * 
  55.  * $v = getglobal(‘test‘); // $v = $_G[‘test‘] 
  56.  * $v = getglobal(‘test/hello/ok‘);  // $v = $_G[‘test‘][‘hello‘][‘ok‘] 
  57.  */  
  58. function getglobal($key, $group = null) {  
  59.     ......      
  60. }  
  61.   
  62. /** 
  63.  * 取出 get, post, cookie 当中的某个变量 
  64.  * 
  65.  * @param string $k  key 值 
  66.  * @param string $type 类型 
  67.  * @return mix 
  68.  */  
  69. function getgpc($k, $type=‘GP‘) {  
  70.     ......      
  71. }  
  72.   
  73. /** 
  74.  * 根据uid 获取用户基本数据 
  75.  * @staticvar array $users 存放已经获取的用户的信息,避免重复查库 
  76.  * @param <int> $uid 
  77.  * @return <array> 
  78.  */  
  79. function getuserbyuid($uid) {  
  80.     ......      
  81. }  
  82.   
  83. /** 
  84. * 获取当前用户的扩展资料 
  85. * @param $field 字段 
  86. */  
  87. function getuserprofile($field) {  
  88.     ......      
  89. }  
  90.   
  91. /** 
  92.  * 对字符串或者输入进行 addslashes 操作 
  93.  * @param <mix> $string 
  94.  * @param <int> $force 
  95.  * @return <mix> 
  96.  */  
  97. function daddslashes($string, $force = 1) {  
  98.     ......      
  99. }  
  100.   
  101. /** 
  102.  * 对字符串进行加密和解密 
  103.  * @param <string> $string 
  104.  * @param <string> $operation  DECODE 解密 | ENCODE  加密 
  105.  * @param <string> $key 当为空的时候,取全局密钥 
  106.  * @param <int> $expiry 有效期,单位秒 
  107.  * @return <string> 
  108.  */  
  109. function authcode($string, $operation = ‘DECODE‘, $key = ‘‘, $expiry = 0) {  
  110.     ......      
  111. }  
  112.   
  113. /** 
  114.  * 远程文件文件请求兼容函数 
  115.  */  
  116. function dfsockopen($url, $limit = 0, $post = ‘‘, $cookie = ‘‘, $bysocket = FALSE, $ip = ‘‘, $timeout = 15, $block = TRUE) {  
  117.     ......      
  118. }  
  119.   
  120. /** 
  121. * HTML转义字符 
  122. * @param $string - 字符串 
  123. * @return 返回转义好的字符串 
  124. */  
  125. function dhtmlspecialchars($string) {  
  126.     ......      
  127. }  
  128.   
  129. /** 
  130.  * 退出程序 同 exit 的区别, 对输出数据会进行 重新加工和处理 
  131.  * 通常情况下,我们建议使用本函数终止程序, 除非有特别需求 
  132.  * @param <type> $message 
  133.  */  
  134. function dexit($message = ‘‘) {  
  135.     ......      
  136. }  
  137.   
  138. /** 
  139.  * 同 php header函数, 针对 location 跳转做了特殊处理 
  140.  * @param <type> $string 
  141.  * @param <type> $replace 
  142.  * @param <type> $http_response_code 
  143.  */  
  144. function dheader($string, $replace = true, $http_response_code = 0) {  
  145.     ......      
  146. }  
  147.   
  148. /** 
  149. * 设置cookie 
  150. * @param $var - 变量名 
  151. * @param $value - 变量值 
  152. * @param $life - 生命期 
  153. * @param $prefix - 前缀 
  154. * @param $httponly - 安全属性 
  155. */  
  156. function dsetcookie($var, $value = ‘‘, $life = 0, $prefix = 1, $httponly = false) {  
  157.     ......      
  158. }  
  159.   
  160. /** 
  161.  * 获取cookie 
  162.  * @param $key - cookie名称,不需要带前缀 
  163.  */  
  164. function getcookie($key) {  
  165.     ......      
  166. }  
  167.   
  168. /** 
  169.  * 获取文件扩展名 
  170.  * @param $filename 文件名 
  171.  */  
  172. function fileext($filename) {  
  173.     ......      
  174. }  
  175.   
  176. /** 
  177. * 检查是否是以手机浏览器进入(IN_MOBILE) 
  178. */  
  179. function checkmobile() {  
  180.     ......      
  181. }  
  182.   
  183. /** 
  184.  * 字符串方式实现 preg_match("/(s1|s2|s3)/", $string, $match) 
  185.  * @param string $string 源字符串 
  186.  * @param array $arr 要查找的字符串 如array(‘s1‘, ‘s2‘, ‘s3‘) 
  187.  * @param bool $returnvalue 是否返回找到的值 
  188.  * @return bool 
  189.  */  
  190. function dstrpos($string, &$arr, $returnvalue = false) {  
  191.     ......      
  192. }  
  193.   
  194. /** 
  195. * 检查邮箱是否有效 
  196. * @param $email 要检查的邮箱 
  197. * @param 返回结果 
  198. */  
  199. function isemail($email) {  
  200.     ......      
  201. }  
  202.   
  203. /** 
  204. * 问题答案加密 
  205. * @param $questionid - 问题 
  206. * @param $answer - 答案 
  207. * @return 返回加密的字串 
  208. */  
  209. function quescrypt($questionid, $answer) {  
  210.     ......      
  211. }  
  212.   
  213. /** 
  214. * 产生随机码 
  215. * @param $length - 要多长 
  216. * @param $numberic - 数字还是字符串 
  217. * @return 返回字符串 
  218. */  
  219. function random($length, $numeric = 0) {  
  220.     ......      
  221. }  
  222.   
  223. /** 
  224.  * 判断一个字符串是否在另一个字符串中存在 
  225.  * 
  226.  * @param string 原始字串 $string 
  227.  * @param string 查找 $find 
  228.  * @return boolean 
  229.  */  
  230. function strexists($string, $find) {  
  231.     ......      
  232. }  
  233.   
  234. /** 
  235.  * 获取头像 
  236.  * 
  237.  * @param int $uid 需要获取的用户UID值 
  238.  * @param string $size 获取尺寸 ‘small‘, ‘middle‘, ‘big‘ 
  239.  * @param boolean $returnsrc 是否直接返回图片src 
  240.  * @param boolean $real 是否返回真实图片 
  241.  * @param boolean $static 是否返回真实路径 
  242.  * @param string $ucenterurl 强制uc路径 
  243.  */  
  244. function avatar($uid, $size = ‘middle‘, $returnsrc = FALSE, $real = FALSE, $static = FALSE, $ucenterurl = ‘‘) {  
  245.     ......      
  246. }  
  247.   
  248. /** 
  249. * 加载语言 
  250. * 语言文件统一为 $lang = array(); 
  251. * @param $file - 语言文件,可包含路径如 forum/xxx home/xxx 
  252. * @param $langvar - 语言文字索引 
  253. * @param $vars - 变量替换数组 
  254. * @param $default - 指定默认值,当找不到对应言包时生效 
  255. * @return 语言文字 
  256. */  
  257. function lang($file, $langvar = null, $vars = array(), $default = null) {  
  258.     ......      
  259. }  
  260.   
  261. /** 
  262. * 检查模板源文件是否更新 
  263. * 当编译文件不存时强制重新编译 
  264. * 当 tplrefresh = 1 时检查文件 
  265. * 当 tplrefresh > 1 时,则根据 tplrefresh 取余,无余时则检查更新 
  266. * 
  267. */  
  268. function checktplrefresh($maintpl, $subtpl, $timecompare, $templateid, $cachefile, $tpldir, $file) {  
  269.     ......      
  270. }  
  271.   
  272. /** 
  273. * 解析模板 
  274. * @return 返回域名 
  275. */  
  276. function template($file, $templateid = 0, $tpldir = ‘‘, $gettplfile = 0, $primaltpl=‘‘) {  
  277.     ......      
  278. }  
  279.   
  280. /** 
  281.  * 对某id进行个性化md5 
  282.  */  
  283. function modauthkey($id) {  
  284.     ......      
  285. }  
  286.   
  287. /** 
  288.  * 获得当前应用页面选中的导航id 
  289.  */  
  290. function getcurrentnav() {  
  291.     ......      
  292. }  
  293.   
  294. /** 
  295. * 读取缓存 
  296. * @param $cachenames - 缓存名称数组或字串 
  297. */  
  298. function loadcache($cachenames, $force = false) {  
  299.     ......      
  300. }  
  301.   
  302. /** 
  303.  * 通过memcache\mysql\file等几种手段读缓存 
  304.  * @param mixed $cachenames 缓存名的数组或字串 
  305.  */  
  306. function cachedata($cachenames) {  
  307.     ......      
  308. }  
  309.   
  310. /** 
  311. * 格式化时间 
  312. * @param $timestamp - 时间戳 
  313. * @param $format - dt=日期时间 d=日期 t=时间 u=个性化 其他=自定义 
  314. * @param $timeoffset - 时区 
  315. * @return string 
  316. */  
  317. function dgmdate($timestamp, $format = ‘dt‘, $timeoffset = ‘9999‘, $uformat = ‘‘) {  
  318.     ......      
  319. }  
  320.   
  321. /** 
  322.     得到时间戳 
  323. */  
  324. function dmktime($date) {  
  325.     ......      
  326. }  
  327.   
  328. /** 
  329. * 更新缓存 
  330. * @param $cachename - 缓存名称 
  331. * @param $data - 缓存数据 
  332. */  
  333. function save_syscache($cachename, $data) {  
  334.     ......      
  335. }  
  336.   
  337. /** 
  338. * Portal模块 
  339. * @param $parameter - 参数集合 
  340. */  
  341. function block_get($parameter) {  
  342.     ......      
  343. }  
  344.   
  345. /** 
  346. * Portal 模块显示 
  347. * 
  348. * @param $parameter - 参数集合 
  349. */  
  350. function block_display($bid) {  
  351.     ......      
  352. }  
  353.   
  354. /** 
  355. * 返回库文件的全路径 
  356. * 
  357. * @param string $libname 库文件分类及名称 
  358. * @param string $folder 模块目录‘module‘,‘include‘,‘class‘ 
  359. * @return string 
  360. * 
  361. * @example require DISCUZ_ROOT.‘./source/function/function_cache.php‘ 
  362. * @example 我们可以利用此函数简写为:require libfile(‘function/cache‘); 
  363. * 
  364. */  
  365. function libfile($libname, $folder = ‘‘) {  
  366.     ......      
  367. }  
  368.   
  369. /** 
  370.  * 针对uft-8进行特殊处理的strlen 
  371.  * @param string $str 
  372.  * @return int 
  373.  */  
  374. function dstrlen($str) {  
  375.     ......      
  376. }  
  377.   
  378. /** 
  379. * 根据中文裁减字符串 
  380. * @param $string - 字符串 
  381. * @param $length - 长度 
  382. * @param $doc - 缩略后缀 
  383. * @return 返回带省略号被裁减好的字符串 
  384. */  
  385. function cutstr($string, $length, $dot = ‘ ...‘) {  
  386.     ......      
  387. }  
  388.   
  389. /** 
  390. * 论坛 aid url 生成 
  391. */  
  392. function aidencode($aid, $type = 0, $tid = 0) {  
  393.     ......      
  394. }  
  395.   
  396. /** 
  397.  * 返回论坛缩放附件图片的地址 url 
  398.  */  
  399. function getforumimg($aid, $nocache = 0, $w = 140, $h = 140, $type = ‘‘) {  
  400.     ......      
  401. }  
  402.   
  403.   
  404. /** 
  405.  * 获取rewrite字符串 
  406.  * @param string $type 需要获取的rewite 
  407.  * @param boolean $returntype true:直接返回href, false:返回a标签 
  408.  * @param string $host 可选网站域名 
  409.  * @return string 
  410.  */  
  411. function rewriteoutput($type, $returntype, $host) {  
  412.     ......      
  413. }  
  414.   
  415. /** 
  416. * 手机模式下替换所有链接为mobile=yes形式 
  417. * @param $file - 正则匹配到的文件字符串 
  418. * @param $file - 要被替换的字符串 
  419. * @$replace 替换后字符串 
  420. */  
  421. function mobilereplace($file, $replace) {  
  422.     ......      
  423. }  
  424.   
  425. /** 
  426. * 手机的output函数 
  427. */  
  428. function mobileoutput() {  
  429.     ......      
  430. }  
  431.   
  432. /** 
  433. * 系统输出 
  434. * @return 返回内容 
  435. */  
  436. function output() {  
  437.     ......      
  438. }  
  439.   
  440. /** 
  441.  * ajax footer使用输出页面内容 
  442.  */  
  443. function output_ajax() {  
  444.     ......      
  445. }  
  446.   
  447. /** 
  448.  * 运行钩子 
  449.  */  
  450. function runhooks() {  
  451.     ......      
  452. }  
  453.   
  454. /** 
  455.  * 执行插件脚本 
  456.  */  
  457. function hookscript($script, $hscript, $type = ‘funcs‘, $param = array(), $func = ‘‘) {  
  458.     ......      
  459. }  
  460.   
  461. /** 
  462.  * 获取插件模块 
  463.  */  
  464. function pluginmodule($pluginid, $type) {  
  465.     ......      
  466. }  
  467.   
  468. /** 
  469.  * 执行积分规则 
  470.  * @param String $action:  规则action名称 
  471.  * @param Integer $uid: 操作用户 
  472.  * @param array $extrasql: common_member_count的额外操作字段数组格式为 array(‘extcredits1‘ => ‘1‘) 
  473.  * @param String $needle: 防重字符串 
  474.  * @param Integer $coef: 积分放大倍数 
  475.  * @param Integer $update: 是否执行更新操作 
  476.  * @param Integer $fid: 版块ID 
  477.  * @return 返回积分策略 
  478.  */  
  479. function updatecreditbyaction($action, $uid = 0, $extrasql = array(), $needle = ‘‘, $coef = 1, $update = 1, $fid = 0) {  
  480.     ......      
  481. }  
  482.   
  483. /** 
  484. * 检查积分下限 
  485. * @param string $action: 策略动作Action或者需要检测的操作积分值使如extcredits1积分进行减1操作检测array(‘extcredits1‘ => -1) 
  486. * @param Integer $uid: 用户UID 
  487. * @param Integer $coef: 积分放大倍数/负数为减分操作 
  488. * @param Integer $returnonly: 只要返回结果,不用中断程序运行 
  489. */  
  490. function checklowerlimit($action, $uid = 0, $coef = 1, $fid = 0, $returnonly = 0) {  
  491.     ......      
  492. }  
  493.   
  494. /** 
  495.  * 批量执行某一条策略规则 
  496.  * @param String $action:  规则action名称 
  497.  * @param Integer $uids: 操作用户可以为单个uid或uid数组 
  498.  * @param array $extrasql: common_member_count的额外操作字段数组格式为 array(‘extcredits1‘ => ‘1‘) 
  499.  * @param Integer $coef: 积分放大倍数,当为负数时为反转操作 
  500.  * @param Integer $fid: 版块ID 
  501.  */  
  502. function batchupdatecredit($action, $uids = 0, $extrasql = array(), $coef = 1, $fid = 0) {  
  503.     ......      
  504. }  
  505.   
  506. /** 
  507.  * 添加积分 
  508.  * @param Integer $uids: 用户uid或者uid数组 
  509.  * @param String $dataarr: member count相关操作数组,例: array(‘threads‘ => 1, ‘doings‘ => -1) 
  510.  * @param Boolean $checkgroup: 是否检查用户组 true or false 
  511.  * @param String $operation: 操作类型 
  512.  * @param Integer $relatedid: 
  513.  * @param String $ruletxt: 积分规则文本 
  514.  */  
  515.   
  516. function updatemembercount($uids, $dataarr = array(), $checkgroup = true, $operation = ‘‘, $relatedid = 0, $ruletxt = ‘‘) {  
  517.     if(!emptyempty($uids) && (is_array($dataarr) && $dataarr)) {  
  518.         require_once libfile(‘function/credit‘);  
  519.         return _updatemembercount($uids, $dataarr, $checkgroup, $operation, $relatedid, $ruletxt);  
  520.     }  
  521.     return true;  
  522. }  
  523.   
  524. /** 
  525.  * 校验用户组 
  526.  * @param $uid 
  527.  */  
  528. function checkusergroup($uid = 0) {  
  529.     ......      
  530. }  
  531.   
  532. /** 
  533. * 调试信息 
  534. */  
  535. function debuginfo() {  
  536.     ......      
  537. }  
  538.   
  539. /** 
  540.  * 随机取出一个站长推荐的条目 
  541.  * @param $module 当前模块 
  542.  * @return array 
  543. */  
  544. function getfocus_rand($module) {  
  545.     ......      
  546. }  
  547.   
  548. /** 
  549.  * 检查验证码正确性 
  550.  * @param $value 验证码变量值 
  551.  */  
  552. function check_seccode($value, $idhash) {  
  553.     ......      
  554. }  
  555.   
  556. /** 
  557.  * 检查验证问答正确性 
  558.  * @param $value 验证问答变量值 
  559.  */  
  560. function check_secqaa($value, $idhash) {  
  561.     ......      
  562. }  
  563.   
  564. /** 
  565.  * 获取广告 
  566.  */  
  567. function adshow($parameter) {  
  568.     ......      
  569. }  
  570.   
  571. /** 
  572.  * 显示提示信息 
  573.  * @param $message - 提示信息,可中文也可以是 lang_message.php 中的数组 key 值 
  574.  * @param $url_forward - 提示后跳转的 url 
  575.  * @param $values - 提示信息中可替换的变量值 array(key => value ...) 形式 
  576.  * @param $extraparam - 扩展参数 array(key => value ...) 形式 
  577.  *  跳转控制 
  578.         header      header跳转 
  579.         location    location JS 跳转,限于 msgtype = 2、3 
  580.         timeout     定时跳转 
  581.         refreshtime 自定义跳转时间 
  582.         closetime   自定义关闭时间,限于 msgtype = 2,值为 true 时为默认 
  583.         locationtime    自定义跳转时间,限于 msgtype = 2,值为 true 时为默认 
  584.     内容控制 
  585.         alert       alert 图标样式 right/info/error 
  586.         return      显示请返回 
  587.         redirectmsg 下载时用的提示信息,当跳转时显示的信息样式 
  588.                     0:如果您的浏览器没有自动跳转,请点击此链接 
  589.                     1:如果 n 秒后下载仍未开始,请点击此链接 
  590.         msgtype     信息样式 
  591.                     1:非 Ajax 
  592.                     2:Ajax 弹出框 
  593.                     3:Ajax 只显示信息文本 
  594.         showmsg     显示信息文本 
  595.         showdialog  关闭原弹出框显示 showDialog 信息,限于 msgtype = 2 
  596.         login       未登录时显示登录链接 
  597.         extrajs     扩展 js 
  598.         striptags   过滤 HTML 标记 
  599.     Ajax 控制 
  600.         handle      执行 js 回调函数 
  601.         showid      控制显示的对象 ID 
  602.  */  
  603. function showmessage($message, $url_forward = ‘‘, $values = array(), $extraparam = array(), $custom = 0) {  
  604.     ......      
  605. }  
  606.   
  607. /** 
  608. * 检查是否正确提交了表单 
  609. * @param $var 需要检查的变量 
  610. * @param $allowget 是否允许GET方式 
  611. * @param $seccodecheck 验证码检测是否开启 
  612. * @return 返回是否正确提交了表单 
  613. */  
  614. function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0) {  
  615.     ......      
  616. }  
  617.   
  618. /** 
  619. * 分页 
  620. * @param $num - 总数 
  621. * @param $perpage - 每页数 
  622. * @param $curpage - 当前页 
  623. * @param $mpurl - 跳转的路径 
  624. * @param $maxpages - 允许显示的最大页数 
  625. * @param $page - 最多显示多少页码 
  626. * @param $autogoto - 最后一页,自动跳转 
  627. * @param $simple - 是否简洁模式(简洁模式不显示上一页、下一页和页码跳转) 
  628. * @return 返回分页代码 
  629. */  
  630. function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = FALSE, $simple = FALSE) {  
  631.     ......      
  632. }  
  633.   
  634. /** 
  635. * 只有上一页下一页的分页(无需知道数据总数) 
  636. * @param $num - 本次所取数据条数 
  637. * @param $perpage - 每页数 
  638. * @param $curpage - 当前页 
  639. * @param $mpurl - 跳转的路径 
  640. * @return 返回分页代码 
  641. */  
  642. function simplepage($num, $perpage, $curpage, $mpurl) {  
  643.     ......      
  644. }  
  645.   
  646. /** 
  647.  * 词语过滤 
  648.  * @param $message - 词语过滤文本 
  649.  * @return 成功返回原始文本,否则提示错误或被替换 
  650.  */  
  651. function censor($message, $modword = NULL, $return = FALSE) {  
  652.     ......      
  653. }  
  654.   
  655. /** 
  656.     词语过滤,检测是否含有需要审核的词 
  657. */  
  658. function censormod($message) {  
  659.     ......      
  660. }  
  661.   
  662. /** 
  663. * 刷新重定向 
  664. */  
  665. function dreferer($default = ‘‘) {  
  666.     ......      
  667. }  
  668.   
  669. /** 
  670.  * 远程FTP使用 
  671.  */  
  672. function ftpcmd($cmd, $arg1 = ‘‘) {  
  673.     ......      
  674. }  
  675.   
  676. /** 
  677.  * 编码转换 
  678.  * @param <string> $str 要转码的字符 
  679.  * @param <string> $in_charset 输入字符集 
  680.  * @param <string> $out_charset 输出字符集(默认当前) 
  681.  * @param <boolean> $ForceTable 强制使用码表(默认不强制) 
  682.  * 
  683.  */  
  684. function diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE) {  
  685.     ......      
  686. }  
  687.   
  688. /** 
  689.  * 重建数组 
  690.  * @param <string> $array 需要反转的数组 
  691.  * @return array 原数组与的反转后的数组 
  692.  */  
  693. function renum($array) {  
  694.     ......      
  695. }  
  696.   
  697. /** 
  698.  * 获取当前脚本在线人数 
  699.  * @param <int> $fid 分类 ID,版块、群组 的 id, 
  700.  * @param <int> $tid 内容 ID,帖子 的 id 
  701.  */  
  702. function getonlinenum($fid = 0, $tid = 0) {  
  703.     ......      
  704. }  
  705.   
  706. /** 
  707. * 字节格式化单位 
  708. * @param $filesize - 大小(字节) 
  709. * @return 返回格式化后的文本 
  710. */  
  711. function sizecount($size) {  
  712.     ......      
  713. }  
  714.   
  715. /** 
  716.  * 写入运行日志 
  717.  */  
  718. function writelog($file, $log) {  
  719.     ......      
  720. }  
  721.   
  722. /** 
  723.  * 调色板 
  724.  * @param <type> $colorid 
  725.  * @param <type> $id 
  726.  * @param <type> $background 
  727.  * @return <type> 
  728.  */  
  729. function getcolorpalette($colorid, $id, $background, $fun = ‘‘) {  
  730.     ......      
  731. }  
  732.   
  733. /** 
  734.  * 取得某标志位的数值 (0|1) 
  735.  * 
  736.  * @param 数值 $status 
  737.  * @param 位置 $position 
  738.  * @return 0 | 1 
  739.  */  
  740. function getstatus($status, $position) {  
  741.     ......      
  742. }  
  743.   
  744. /** 
  745.  * 设置某一bit位的数值 0 or 1 
  746.  * 
  747.  * @param int $position  1-16 
  748.  * @param int $value  0|1 
  749.  * @param 原始数值 $baseon  0x0000-0xffff 
  750.  * @return int 
  751.  */  
  752. function setstatus($position, $value, $baseon = null) {  
  753.     ......      
  754. }  
  755.   
  756. /** 
  757.  * 通知 
  758.  * @param Integer $touid: 通知给谁 
  759.  * @param String $type: 通知类型 
  760.  * @param String $note: 语言key 
  761.  * @param Array $notevars: 语言变量对应的值 
  762.  * @param Integer $system: 是否为系统通知 0:非系统通知; 1:系统通知 
  763.  */  
  764. function notification_add($touid, $type, $note, $notevars = array(), $system = 0) {  
  765.     ......      
  766. }  
  767.   
  768. /** 
  769. * 发送管理通知 
  770. * @param $type - 通知类型 
  771. */  
  772. function manage_addnotify($type, $from_num = 0, $langvar = array()) {  
  773.     ......      
  774. }  
  775.   
  776. /** 
  777. * 发送短消息(兼容提醒) 
  778. * @param $toid - 接收方id 
  779. * @param $subject - 标题 
  780. * @param $message - 内容 
  781. * @param $fromid - 发送方id 
  782. */  
  783. function sendpm($toid, $subject, $message, $fromid = ‘‘, $replypmid = 0, $isusername = 0, $type = 0) {  
  784.     ......      
  785. }  
  786.   
  787. /** 
  788.  * 
  789.  * 通过tid得到相应的单一post表名或post表集合 
  790.  * @param <mix> $tids: 允许传进单个tid,也可以是tid集合 
  791.  * @param $primary: 是否只查主题表 0:遍历所有表;1:只查主表 
  792.  * @return 当传进来的是单一的tid将直接返回表名,否则返回表集合的二维数组例:array(‘forum_post‘ => array(tids),‘forum_post_1‘ => array(tids)) 
  793.  * @TODO tid传进来的是字符串的,返回单个表名,传进来的是数组的,不管是不是一个数组,返回的还是数组,保证进出值对应 
  794.  */  
  795. function getposttablebytid($tids, $primary = 0) {  
  796.     ......      
  797. }  
  798.   
  799. /** 
  800.  * 获取论坛帖子表名 
  801.  * @param <int> $tableid: 分表ID,默认为:fourm_post表 
  802.  * @param <boolean> $prefix: 是否默认带有表前缀 
  803.  * @return forum_post or forum_post_* 
  804.  */  
  805. function getposttable($tableid = 0, $prefix = false) {  
  806.     ......      
  807. }  
  808.   
  809. /** 
  810.  * 内存读写接口函数 
  811.  * 
  812.  * @param 命令 $cmd (set|get|rm|check) 
  813.  * @param 键值 $key 
  814.  * @param 数据 $value 
  815.  * @param 有效期 $ttl 
  816.  * @return mix 
  817.  * 
  818.  * @example set : 写入内存 $ret = memory(‘set‘, ‘test‘, ‘ok‘) 
  819.  * @example get : 读取内存 $data = memory(‘get‘, ‘test‘) 
  820.  * @example rm : 删除内存  $ret = memory(‘rm‘, ‘test‘) 
  821.  * @example check : 检查内存功能是否可用 $allow = memory(‘check‘) 
  822.  */  
  823. function memory($cmd, $key=‘‘, $value=‘‘, $ttl = 0) {  
  824.     ......      
  825. }  
  826.   
  827. /** 
  828. * ip允许访问 
  829. * @param $ip 要检查的ip地址 
  830. * @param - $accesslist 允许访问的ip地址 
  831. * @param 返回结果 
  832. */  
  833. function ipaccess($ip, $accesslist) {  
  834.     ......      
  835. }  
  836.   
  837. /** 
  838. * ip限制访问 
  839. * @param $ip 要检查的ip地址 
  840. * @param 返回结果 
  841. */  
  842. function ipbanned($onlineip) {  
  843.     ......      
  844. }  
  845.   
  846. /** 
  847.  * 系统级消息 
  848.  */  
  849. function sysmessage($message) {  
  850.     ......      
  851. }  
  852.   
  853. /** 
  854. * 论坛权限 
  855. * @param $permstr - 权限信息 
  856. * @param $groupid - 只判断用户组 
  857. * @return 0 无权限 > 0 有权限 
  858. */  
  859. function forumperm($permstr, $groupid = 0) {  
  860.     ......      
  861. }  
  862.   
  863. /** 
  864.  * PHP 兼容性函数 
  865.  */  
  866. if(!function_exists(‘file_put_contents‘)) {  
  867.     if(!defined(‘FILE_APPEND‘)) define(‘FILE_APPEND‘, 8);  
  868.     function file_put_contents($filename, $data, $flag = 0) {  
  869.         $return = false;  
  870.         if($fp = @fopen($filename, $flag != FILE_APPEND ? ‘w‘ : ‘a‘)) {  
  871.             if($flag == LOCK_EX) @flock($fp, LOCK_EX);  
  872.             $return = fwrite($fp, is_array($data) ? implode(‘‘, $data) : $data);  
  873.             fclose($fp);  
  874.         }  
  875.         return $return;  
  876.     }  
  877. }  
  878.   
  879. //检查权限  
  880. function checkperm($perm) {  
  881.     global $_G;  
  882.     return (emptyempty($_G[‘group‘][$perm])?‘‘:$_G[‘group‘][$perm]);  
  883. }  
  884.   
  885. /** 
  886. * 时间段设置检测 
  887. * @param $periods - 那种时间段 $settings[$periods]  $settings[‘postbanperiods‘] $settings[‘postmodperiods‘] 
  888. * @param $showmessage - 是否提示信息 
  889. * @return 返回检查结果 
  890. */  
  891. function periodscheck($periods, $showmessage = 1) {  
  892.     ......      
  893. }  
  894.   
  895. /** 
  896.  * 用户操作日志 
  897.  * @param int $uid 用户ID 
  898.  * @param string $action 操作类型 tid=thread pid=post blogid=blog picid=picture doid=doing sid=share aid=article uid_cid/blogid_cid/sid_cid/picid_cid/aid_cid/topicid_cid=comment 
  899.  * @return bool 
  900.  */  
  901. function useractionlog($uid, $action) {  
  902.     ......      
  903. }  
  904.   
  905. /** 
  906.  * 得到用户操作的代码或代表字符,参数为数字返回字符串,参数为字符串返回数字 
  907.  * @param string/int $var 
  908.  * @return int/string 注意:如果失败返回false,请使用===判断,因为代码0代表tid 
  909.  */  
  910. function getuseraction($var) {  
  911.     ......      
  912. }  
  913.   
  914. /** 
  915.  * 获取我的中心中展示的应用 
  916.  */  
  917. function getuserapp($panel = 0) {  
  918.     ......      
  919. }  
  920.   
  921. /** 
  922.  * 获取manyou应用本地图标路径 
  923.  * @param <type> $appid 
  924.  */  
  925. function getmyappiconpath($appid, $iconstatus=0) {  
  926.     ......      
  927. }  
  928.   
  929. /** 
  930.  * 获取文字内的url列表 
  931.  * 
  932.  * @param $message 文字 
  933.  * @return <array> url列表 
  934.  * 
  935.  */  
  936. function get_url_list($message) {  
  937.     ......      
  938. }  
  939.   
  940. /** 
  941.  * 检查文字内的URL 
  942.  * 
  943.  * @param $allowposturl 用户组设置中的值 0=禁止 1=允许但审核 2=允许但不解析 
  944.  * @param $message 待处理的文字内容 
  945.  * @return 0=禁止 1=允许但审核 2=允许但不解析 
  946.  */  
  947. function checkurl($allowposturl, &$message) {  
  948.     ......      
  949. }  
  950.   
  951. /** 
  952.  * 更新页面和模块的关系 
  953.  * @param string $targettplname 页面名称 
  954.  * @param array $blocks 模块IDS 
  955.  */  
  956. function update_template_block($targettplname, $blocks) {  
  957.     ......      
  958. }  
  959.   
  960. /** 
  961.  * 获取批定类型的关联连接 
  962.  * 
  963.  * @param string $extent 内容所需关联链接范围 article, forum, group, blog 
  964.  * @return string 有效的关联链接 
  965.  */  
  966. function getrelatedlink($extent) {  
  967.     ......      
  968. }  
  969.   
  970. /** 
  971.  * 判断 Connect 链接参数有效性 
  972.  * @global  $_G 
  973.  * @param array $params 参数数组 
  974.  * @param array $connect_params 返回参数 
  975.  * @return boolean 
  976.  */  
  977. function connect_valid($params, &$connect_params) {  
  978.     ......      
  979. }  
  980.   
  981. /** 
  982.  * 获取 Token 
  983.  * @global  $_G 
  984.  * @param string $type 
  985.  * @return string 
  986.  */  
  987. function connect_get_access_token($type = ‘USER‘) {  
  988.     ......      
  989. }  
  990.   
  991. /** 
  992.  * 获取 Connect 参数签名 
  993.  * @param array $params 参数数组 
  994.  * @param string $access_token 加密 Token 
  995.  * @return string 
  996.  */  
  997. function connect_get_sig($params, $access_token) {  
  998.     ......      
  999. }  
  1000.   
  1001. /** 
  1002.  * 通过 AID 获取附件表名 
  1003.  * @param <int> $aid 
  1004.  */  
  1005. function getattachtablebyaid($aid) {  
  1006.     ......      
  1007. }  
  1008.   
  1009. /** 
  1010.  * 返回指定 TID 所对应的附件表编号 
  1011.  * @param <int> $tid 
  1012.  */  
  1013. function getattachtableid($tid) {  
  1014.     ......      
  1015. }  
  1016.   
  1017. /** 
  1018.  * 通过 TID 获取附件表名 
  1019.  * @param <int> $tid 
  1020.  */  
  1021. function getattachtablebytid($tid) {  
  1022.     ......      
  1023. }  
  1024.   
  1025. /** 
  1026.  * 通过 PID 获取附件表名 
  1027.  * @param <int> $pid 
  1028.  */  
  1029. function getattachtablebypid($pid) {  
  1030.     ......      
  1031. }  
  1032.   
  1033. /** 
  1034.  * 添加一个新的附件索引记录,并返回新附件 ID 
  1035.  * @param <int> $uid 
  1036.  */  
  1037. function getattachnewaid($uid = 0) {  
  1038.     ......      
  1039. }  
  1040.   
  1041. /** 
  1042.  * 获取 SEO设置 
  1043.  * @param string $page 调用哪个页面的 
  1044.  * @param array $data 可替换数据 
  1045.  * @return array(‘seotitle‘, ‘seodescription‘, ‘seokeywords‘) 
  1046.  */  
  1047. function get_seosetting($page, $data = array(), $defset = array()) {  
  1048.     ......      
  1049. }  
  1050.   
  1051. /** 
  1052.  * 需处理连续分隔符的str_replace() 
  1053.  * @param array $searchs 被替换的数组 
  1054.  * @param array $replaces 用于替换的数组 
  1055.  * @param string $str 目标字符串 
  1056.  */  
  1057. function strreplace_strip_split($searchs, $replaces, $str) {  
  1058.     ......      
  1059. }  
  1060.   
  1061. /** 
  1062.  * 返回带第几页的title 
  1063.  * @global  $_G 
  1064.  * @param string $navtitle 源标题 
  1065.  * @param int $page 页码 
  1066.  * @return string 
  1067.  */  
  1068. function get_title_page($navtitle, $page){  
  1069.     if($page > 1) {  
  1070.     ......      
  1071. }  
  1072.   
  1073. /** 
  1074.  * 
  1075.  * 生成缩略图文件名 
  1076.  * @param String $fileStr: 原文件名,允许附带路径 
  1077.  * @param String $extend: 新文件名后缀 
  1078.  * @param Boolean $holdOldExt: 是否保留原扩展名 
  1079.  * @return 返加新的后缀文件名 
  1080.  */  
  1081. function getimgthumbname($fileStr, $extend=‘.thumb.jpg‘, $holdOldExt=true) {  
  1082.     ......      
  1083. }  
  1084.   
  1085. /** 
  1086.  * 更新数据的审核状态 
  1087.  * @param <string> $idtype 数据类型 tid=thread pid=post blogid=blog picid=picture doid=doing sid=share aid=article uid_cid/blogid_cid/sid_cid/picid_cid/aid_cid/topicid_cid=comment 
  1088.  * @param <array/int> $ids ID 数组、ID 值 
  1089.  * @param <int> $status 状态 0=加入审核(默认) 1=忽略审核 2=审核通过 
  1090.  */  
  1091. function updatemoderate($idtype, $ids, $status = 0) {  
  1092.     ......      
  1093. }  
  1094.   
  1095. /** 
  1096.  * 显示漫游应用公告 
  1097.  */  
  1098. function userappprompt() {  
  1099.     ......      
  1100. }  

discuz核心函数库function_core的函数注释

原文:http://www.cnblogs.com/actorai/p/4158865.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!