discuz源代码详解(7).doc_第1页
discuz源代码详解(7).doc_第2页
discuz源代码详解(7).doc_第3页
discuz源代码详解(7).doc_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

discuz源代码详解(7)2009-03-07 14:46以下内容为程序代码:/* 更新版主工作统计的* para string $modaction 进行的何种操作(高亮,关闭,提升)* para int $posts 一次进行了的个数*/function updatemodworks($modaction, $posts = 1) global $modworkstatus, $db, $tablepre, $discuz_uid, $timestamp, $_DCACHE; $today = gmdate(Y-m-d, $timestamp + $_DCACHEsettingstimeoffset * 3600); if($modworkstatus & $modaction & $posts) $db-query(UPDATE $tablepremodworks SET count=count+1, posts=posts+$posts WHERE uid=$discuz_uid AND modaction=$modaction AND dateline=$today); if(!$db-affected_rows() $db-query(INSERT INTO $tablepremodworks (uid, modaction, dateline, count, posts) VALUES ($discuz_uid, $modaction, $today, 1, $posts); 以下内容为程序代码:/* 写入系统日志* para string $file 写入的日志文件* para string $log 要写入的内容提要* */function writelog($file, $log) global $timestamp, $_DCACHE; $yearmonth = gmdate(Ym, $timestamp + $_DCACHEsettingstimeoffset * 3600); $logdir = DISCUZ_ROOT./forumdata/logs/; $logfile = $logdir.$yearmonth._.$file.php; if(filesize($logfile) 2048000) $dir = opendir($logdir); $length = strlen($file); $maxid = $id = 0; while($entry = readdir($dir) if(strexists($entry, $yearmonth._.$file) $id = intval(substr($entry, $length + 8, -4); $id $maxid & $maxid = $id; closedir($dir); $logfilebak = $logdir.$yearmonth._.$file._.($maxid + 1).php; rename($logfile, $logfilebak); if($fp = fopen($logfile, a) flock($fp, 2); $log = is_array($log) ? $log : array($log); foreach($log as $tmp) fwrite($fp, t.str_replace(array(), , $tmp).n); fclose($fp); 以下内容为程序代码:/* 看成函数的重载,即把implode这个函数重载成在两边加上(单引号)的函数* para array $array* return string*/function implodeids($array) if(!empty($array) return .implode(, is_array($array) ? $array : array($array).; else return ; 以下内容为程序代码:/* 把这三个函数放一起,因为它们三个是一起实现的,即传说中的ajax* 这里说一下ajax的实现方式,一种方法是用XMLHttpRequest异步提交给服务器,服务器返回一个带有数据结点的xml文件* javascript或者php等解析这个xml文档,从而得到数据;另外一种是这个xml文件中含一个CDATA,把已经用HTML格式化好的* 内容返回过来直接用,显然第二种好用,Discuz用的就是这样一个方式。其他用iframe等等就不在这里介绍了,那个一般* 在提交数据检查、异步文件上传的时候用。*/ajaxshowheader生成一个xml头和一个根以及一个CDATAfunction ajaxshowheader() global $charset; header(Expires: -1); header(Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0, FALSE); header(Pragma: no-cache); header(Content-type: application/xml); echo n;/ajaxtemplate组合了ajaxshowheader + 模板 + ajaxshowfooter,使之完整。function ajaxtemplate($tplname) if(!empty($_GETinajax) extract($GLOBALS); updatesession(); ajaxshowheader(); include template($tplname); ajaxshowfooter(); die(); 以下内容为程序代码:/* 过滤., n, r 用的* para string $str 要过滤的string* * return string*/function wipespecial($str) return str_replace(array(., n, r), array(, , ), $str);以下内容为程序代码:/* supser site 数据库连接* 通过$superdb来用,而Discuz本身的是$db*/function supe_dbconnect() global $supe, $db; if(empty($supedbmode)

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论