




免费预览已结束,剩余4页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
discuz源代码详解(5)2009-03-07 14:42以下内容为程序代码:/* 发送PM的函数* para int $toid 对方id* para string $subject PM主题* para int $fromid 发送方id* para string $from 发送方用户名*/function sendpm($toid, $subject, $message, $fromid = , $from = ) extract($GLOBALS, EXTR_SKIP); include language(pms); if(isset($language$subject) eval($subject = addslashes(.$language$subject.);); if(isset($language$message) eval($message = addslashes(.$language$message.);); if(!$fromid & !$from) $fromid = $discuz_uid; $from = $discuz_user; $pmids = array(); foreach(explode(, $toid) as $uid) if(is_numeric($uid) $query = $db-query(INSERT INTO $tableprepms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES ($from, $fromid, $uid, inbox, 1, $subject, $timestamp, $message); if($query) $pmids = $uid; if($toid = implodeids($pmids) $db-query(UPDATE $tablepremembers SET newpm=1 WHERE uid IN ($toid); 以下内容为程序代码:/* 大家熟悉的showmesage终于出现!包含了ajax效果了* para string $message 显示在跳转页面的信息,比如:您已成功登陆* para string $url_forword 下一个url,过三秒会自动跳转过去* para string $extra 这个用来控制一些特殊的显示,比如:HALTED, NOPERM,这样可以控制一些特殊场合,Discuz想得真是太全面了!*/function showmessage($message, $url_forward = , $extra = ) extract($GLOBALS, EXTR_SKIP); global $extrahead, $discuz_action, $debuginfo, $seccode, $fid, $tid, $supe_fromsupesite, $supe_jumpurl, $supe, $charset, $show_message, $_DCACHE; $supe_messagetpl = $supe_error = ; $show_message = $message; $msgforward = unserialize($_DCACHEsettingsmsgforward); $msgforwardrefreshtime = intval($msgforwardrefreshtime); $url_forward = empty($url_forward) ? : (empty($_DCOOKIEsid) & $transsidstatus ? transsid($url_forward) : $url_forward); if($supe_fromsupesite & $supestatus) $supe_messagetpl = supesite_; $extra = ; $supe_error = $url_forward ? false : true; $url_forward = !empty($supe_jumpurl) & !$supe_error ? urldecode($supe_jumpurl) : $url_forward; elseif($url_forward & empty($_GETinajax) & $msgforwardquick & $msgforwardmessages & in_array($message, $msgforwardmessages) updatesession(); dheader(location: .str_replace(&, &, $url_forward); if(in_array($extra, array(HALTED, NOPERM) $fid = $tid = 0; $discuz_action = 254; else $discuz_action = 255; include language(messages); /把message这个语言包加了进来 if(isset($language$message) $supe_pre = $supe_fromsupesite ? supe_ : ; eval($show_message = .($language$supe_pre.$message ? $language$supe_pre.$message : $language$message).;); unset($supe_pre); ajaxtemplate(showmessage_ajax); $extrahead .= $url_forward ? : ; if($advlist = $advlistredirect) foreach($advlist AS $type = $redirectadvs) $advlist$type = $redirectadvsarray_rand($redirectadvs); if($extra = NOPERM & !$passport_status) /get secure code checking status (pos. -2) if($seccodecheck = substr(sprintf(%05b, $seccodestatus), -2, 1) $seccode = random(6, 1) + $seccode0 * 1000000; include template(nopermission); else include template($supe_messagetpl.showmessage); dexit();以下内容为程序代码:/* 用来计算星星月亮太阳显示的* para $num 等级数* */function showstars($num) global $starthreshold; $alt = alt=Rank: .$num.; if(empty($starthreshold) for($i = 0; $i $num; $i+) echo ; else for($i = 3; $i 0; $i-) $numlevel = intval($num / pow($starthreshold, ($i - 1); $num = ($num % pow($starthreshold, ($i - 1); for($j = 0; $j $numlevel; $j+) echo ; 以下内容为程序代码:/* 得到站点* return string 如: */function site() return $_SERVERHTTP_HOST;以下内容为程序代码:/* 这个看成函数重载也无妨,功能就是查找$haystack是不是在$needle中存在* para string $haystack* para string $needle* return boolean*/function strexists($haystack, $needle) return !(strpos($haystack, $needle) = FALSE);以下内容为程序代码:/* 验证码转换,具体功能用处还没研究* para string $seccode 验证码*/function seccodeconvert(&$seccode) $seccode = substr($seccode, -6); $s = sprintf(%04s, base_convert($seccode, 10, 24); $seccode = ; $seccodeunits = BCEFGHJKMPQRTVWXY2346789; for($i = 0; $i = 0x30 & $unit = 0x39) ? $seccodeunits$unit - 0x30 : $seccodeunits$unit - 0x57; 以下内容为程序代码:/* 提交后的检查,主要是检查验证码,安全提问和来路是不是正常。* para string $var 存放在全局变量中的下标* para int $allowget 是不是允许get提交* para int $seccodecheck 验证码检查* para int $secqaacheck 安全提问检查* return boolean*/function submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0) if(empty($GLOBALS$var) return FALSE; else global $_SERVER, $seccode, $seccodeverify, $secanswer, $_DCACHE; if($allowget | ($_SERVERREQUEST_METHOD = POST & $GLOBALSformhash = formhash() & (empty($_SERVERHTTP_REFERER) | preg_replace(/https?:/(:/+).*/i, 1, $_SERVERHTTP_REFERER) = preg_replace(/(:+).*/, 1, $_SERVERHTTP_HOST) if($seccodecheck) $tmp = $seccode0; seccodeconvert($seccode); if(strtoupper($seccodeverify) != $seccode) showmessage(submit_seccode_invalid); $seccode = random(6, 1) + $tmp * 1000000; if($secqaacheck) require_once DISCUZ_ROOT./forumdata/cache/cache_secqaa.php; if(md5($secanswer) != $_DCACHEsecqaasubstr($seccode, 0, 1)answer) showmessage(submit_secqaa_invalid); $seccode = random(1, 1) * 1000000 + substr($seccode, -6); return TRUE; else showmessage(submit_invalid); 以下内容为程序代码:/* 另一个提交检查,检查super site的提交的* para int $allowget 是不是允许get提交* para int $timespan 时间跨度* * return boolean*/function supe_submitcheck($allowget = 0, $timespan = 300) global $supe_seccode, $timestamp, $_DCOOKIE, $supe, $supe_fromsupesite; $supe_hash = isset($_GETsupe_hash) | isset($_POSTsupe_hash) ? (isset($_GETsupe_hash) ? $_GETsupe_hash : $_POSTsupe_hash) : (isset($_DCOOKIEsupe_hash) ? $_DCOOKIEsupe_hash : ); if($supe_fromsupesite & $supestatus & ($allowget | $_SERVERREQUEST_METHOD = POST) & $supe_hash & !empty($supe_seccode) list($check_timestamp, $check_seccode) = explode(t, authcode($supe_hash, DECODE); if($timestamp - $check_timestamp 1 & substr($GLOBALStimestamp, -1) $tplrefresh) if(filemtime($tplfile) filemtime($objfile) require_once DISCUZ_ROOT./include/template.func.php; parse_template($file, $templateid, $tpldir); return $objfile;以下内容为程序代码:/* 得到url中的sid* para string $url* para string tag* para int $wml* return
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 员工有病历签协议书
- 贵州省铜仁地区本年度(2025)小学一年级数学统编版期中考试((上下)学期)试卷及答案
- 友好协会合作协议书
- 古筝购买合同协议书
- 合伙水果批发协议书
- 土地征收补偿协议书
- 取消夫妻互保协议书
- 单独赠予子女协议书
- 单位租用宾馆协议书
- 原木买卖合同协议书
- 事业单位考试职业能力倾向测验(综合管理类A类)试题与参考答案(2024年)
- 2015-2024年十年高考数学真题分类汇编专题23 导数及其应用大题综合(学生版)
- 四川盆地果树病虫害绿色防控-终结性考核-国开(SC)-参考资料
- 水土保持方案投标文件技术部分
- 《新能源汽车》课件 课题四 纯电动汽车
- GB/T 15934-2024电器附件电线组件和互连电线组件
- CQI-23模塑系统评估审核表-中英文
- 2023年重庆市中考化学试卷(B卷)及答案解析
- 湖北省2024年中考生物试卷
- 基于机器学习的腐蚀监测
- 林下经济的开发与利用
评论
0/150
提交评论