Discuz二次开发基本知识总结_discuz_CMS教程
Discuz二次开发基本知识总结,需要对discuz进行二次开发的朋友可以参考下。
一) Discuz!的文件系统目录
注:想搞DZ开发,就得弄懂DZ中每个文件的功能。
a) Admin:后台管理功能模块
b) Api:DZ系统与其它系统之间接口程序
c) Archiver:DZ中,用以搜索引擎优化的无图版
d) Attachments:DZ中 ,用户上传附件的存放目录
e) Customavatars:DZ中,用户自定义头像的目录
f) Forumdata:DZ缓存数据的存放目录
g) Images:DZ模板中的图片存放目录
h) Include:DZ常用函数库,基本功能模块目录
i) Ipdata:DZ统计IP来路用的数据
j) Plugins:DZ插件信息的存放目录
k) Templates:DZ模板文件的存放目录
l) Wap:DZ无线,Wap程序处理目录
二) 必须记熟Discuz!数据库设计的每个表的功能,每个表中每个字段的功能。
关于DZ数据库设计文档,请参阅DZ相关的项目文档(请从本贴附件中下载)
三) Discuz!的流程控制
a) 后台流程控:DZ后台所有的功能,均需要注册到admincp.php文件,每个功能都至少有一个或一个以上的Action(动作),在admincp.php中,可以定义Action的执行权限,分别为:“admin==1”管理员,或“admin==2 || admin==3”超级版主和版主,每个Action对应一个脚本文件,脚本文件的命名为action.inc.php(*.inc.php),并存放在admin目录下,如执行:admincp.php?action=dodo,相当于执行admin目录下的dodo.inc.php文件
b) 前台流程控制:前台的流程控制比较简单:流程是自由的,如:
首页:index.php
会员注册:register.php;
会员登录:logging.php
发贴程序:post.php
会员信息:member.php
论坛内容:forumdisplay.php
查看贴子:viewthread.php
…大部分功能,此处不一一列出…
c) DZ根目下的config.inc.php属于整个DZ系统的配置文件
四) Discuz!的数据处理过程
a) DZ对mysql的数据库操作处理全部封装在dbstuff(db_mysql.class.php)类中
b) 所在的外部数据均通过“daddslashes()”初步过滤,然后再过滤,再根据需要处理
五) Discuz!的显示控制(网站多样式风格输出)
a) 显示层就是大家通常所看到的网站风格了。DZ中每套风络分别在templates及images下对应一个风格文件的存放目录。网站风格的制作,请参阅详细的DZ风格制作文档
b) DZ网站风格文件处理的原理:其实很简单,DZ使用template.func.php中的parse_template()以PHP正则运算把htm模文件中的模板标签,转换成了PHP代码,并根据styleid保存在forumdata/templates下,这个有点像Smarty中的技术。
六) DZ中的语言处理
a) DZ前台及后台中、英语言的实现,均是把语句定义成了语变量,然后在模板输入,语句变量的赋值,均放在模板目录中的*.lang.php文件中,DZ在生成网站风格时就加载了这相应的语言包。
七) DZ如何处理用户信息(存取、计算、更新过程)
新手要做二次开发,都必须掌握这数组中,每个数组元素的意义。
a) DZ的基本信息,如用户信息,Session信息存在如下变量中:
a). $_DCACHE
b). $_COOKIE
c). $_DCOOKIE
d). $_DSESSION
e). $_DPLUGIN
b) 可以通过print_r($GLOBALS),打印全部变量
八) DZ中缓存处理机制
a) DZ中缓存处理过程都放在“cache.func.php”中,DZ的缓存处理比较简单,其原理是把一个数组转换成了PHP代码,并保存在缓存目录下,大家可打开缓存文件查看便知。
b) 使用方法:如果在新开的功能中,需要缓存某部分数据,基本上就是:
1)定义并注册缓存名字。
2)从数据读取相应的数据。
3)数据在写入缓存前作相应处理。
4)最后写入缓存。
具体操作,可以看文件中的代码,做相应的修改即可
九) DZ中模板处理机制
a) DZ独创的模板处理技术,类似于Smarty中的模板处理,只是具体算法,过程不同,Smarty是一种重型模板引擎方案。其原理都是把模板中的变量转换成相应的PHP代码,这个过程实际是模访JAVA中的一次编译,多处运行。
十) DZ中权限处理机制
a) 对于DZ中前台的每相action都有$discuz_action定义,DZ根据用户所在的用户组来判定用户是否具有相应操作$discuz_action的权限。至于后台的权限权验证,则更简单了,依据“admin==1”来确定的
十一) DZ中如何实现URL静态化
a) DZ中的静态有两法,只要懂ReWrite规划的朋友,一看就知。
十二) DZ独创的HTML编辑器,如何截取并使用,如果进行Discuz!代和Html代码的转换
a) 这也算是DZ比较牛的一项技术了,在早期版中,因DZ编辑器的不足,使得很多用户放弃了DZ。实现原理:通过JS把用的一些操作转换成了DZ的bbcode代码。这样子提交了安全性,将带有bbcode代码的内容存入数据,在用户打开页页时,又把bbcode代码转换成html代码
本贴声明:由于时间有限,本贴只有关于DZ部分功能的简短分析。若各位网友,对本文感兴趣并想更为深入了解DZ,请在本贴后回贴!我将尽可能多的DZ技术分析写在本文,不断更新本贴内容。
部分文件说明:
admincp.php 管理
ajax.php ajax功能
announcement.php 公告
attachment 附件
board.php 真正的首页
config.inc.php 这个是配置文件
corpus.php 论坛文集
digest.php 精华帖子
discuz_version.php 论坛版本号
faq.php 问题列表
forumdisplay.php 论坛列表
index.php 跳转页面
loggin.php 认证页面(登录退出)
mail_config.inc.php 邮件配置
member.php 用户操作
memcp.php 个人控制面版
misc.php 零碎功能
my.php 我的帖子
plugin.php 插件
pm.php 短信
post.php 发送帖子
redirect.php 页面重定向
register.php 注册
robots.txt 限制搜索
rss.php rss信息发布
search.php 论坛查询
secode.php 验证码
stats.php 统计
topic.php 首页论坛专题
topicadmin 主题管理
viewpro.php 显示个人信息
viewthread.php 主题显示
文件夹
admin 管理
api 接口
archiver 文档
attachments 附件
customavatars 自定义表情
forumdata 论坛数据包含缓冲数据
images 图片
include 公共文件
install 安装包
ipdata ip地址
plugins 插件
readme 帮助文档
templates 模板
utilities 工具包
wap 手机网站
文件夹include
advertisements.inc.php 广告管理
ajax.js ajax相关
attachment.func.php 附件函数集
bbscode.js 论坛表情
cache.fun.php 缓存函数集
category.inc.php 栏目
chinese.class.php
common.inc.php 最主要的头文件
common.js 最主要的js文件
corpus.func.php 论坛文集函数
counter.inc.php 论坛计数
cron.func.php 计划任务
db_mysql.class.php 数据库
db_mysql_error.inc.php 数据库错误
debug.php 调试信息
discuzcode.func.php 论坛代码
editor.func.php 编辑器
editor.js 编辑器
editpost.inc.php 编辑帖子
floatadv.js 浮动广告
forum.func.php 论坛函数集
global.func.php 全局函数
menu.js 菜单
misc.func.php 其它
newreply.inc.php 新回复
newthread.inc.php 新主题
*pmprompt.inc.php
post.fun.php 发表主题
printable.inc.php 论坛打印
qihoo.js qihoo
relatethreads.inc.php 相关主题
security.inc.php 安全
sendmail.inc.php 邮件
serverbusy.htm 系统繁忙
template.func.php 模板
threadpay.inc.php 购买帖子

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

"Detailed Explanation of Discuz Registration Process: Allowing you to easily modify personal information, specific code examples are required" Discuz is a powerful community forum program that is widely used in various websites. It provides a wealth of user registration and personal information modification. functions and interfaces. This article will introduce you to Discuz's registration process in detail and provide specific code examples to help you easily customize and modify your personal information. 1. User registration process In Discuz, user registration is one of the important functions of the site. The smoothness of the registration process and

Serving 80,000 enterprise users, it has helped users fine-tune 13,000 large models and helped users develop 160,000 large model applications. Since December 2023, the daily API calls of Baidu Smart Cloud Qianfan Large Model Platform have increased by 97% month-on-month. ..From the "pioneer" of the domestic large model platform a year ago to today's large model "super factory", Baidu Intelligent Cloud Qianfan large model platform firmly occupies a leading position in the domestic large model market, but its pace is slow. Didn't stop. On March 21, Baidu Intelligent Cloud held a Qianfan product launch conference in Beijing Shougang Park. Baidu Intelligent Cloud announced during the conference: 1. Joining hands with Beijing Shijingshan District to build the country's first Baidu Intelligent Cloud Qianfan large-scale model industrial innovation base to help Promote the take-off of regional industries; 2. Satisfy the “valency” of enterprises

A must-have for Discuz users! Comprehensive analysis of renaming props! In the Discuz forum, the name change function has always received much attention and demand from users. For some users who need to change their name, name change props can easily modify the user name, and this is also an interesting way of interaction. Let’s take an in-depth look at the renaming props in Discuz, including how to obtain them, how to use them, and solutions to some common problems. 1. Obtain name-changing props in Discuz. Name-changing props are usually purchased through points or the administrator

Overview In order to enable ModelScope users to quickly and conveniently use various models provided by the platform, a set of fully functional Python libraries are provided, which includes the implementation of ModelScope official models, as well as the necessary tools for using these models for inference, finetune and other tasks. Code related to data pre-processing, post-processing, effect evaluation and other functions, while also providing a simple and easy-to-use API and rich usage examples. By calling the library, users can complete tasks such as model reasoning, training, and evaluation by writing just a few lines of code. They can also quickly perform secondary development on this basis to realize their own innovative ideas. The algorithm model currently provided by the library is:

Title: To solve the problem that Discuz WeChat shares cannot be displayed, specific code examples are needed. With the development of the mobile Internet, WeChat has become an indispensable part of people's daily lives. In website development, in order to improve user experience and expand website exposure, many websites will integrate WeChat sharing functions, allowing users to easily share website content to Moments or WeChat groups. However, sometimes when using open source forum systems such as Discuz, you will encounter the problem that WeChat shares cannot be displayed, which brings certain difficulties to the user experience.

Discuz Editor: A powerful web page editing tool that requires specific code examples. With the development of the Internet, website construction and content editing have become more and more important. As a common web page editing tool, Discuz editor plays an important role in website construction. It not only provides a wealth of functions and tools, but also helps users edit and publish content more conveniently. In this article, we will introduce the features and usage of the Discuz editor, and provide some specific code examples to help readers better understand and use

Title: Discuz background account login exception, how to deal with it? When you use the backend management of the Discuz forum system, you may sometimes encounter abnormal account login. This could be due to a variety of reasons, including a wrong password, account being blocked, network connection issues, etc. When encountering this situation, we need to solve the problem through simple troubleshooting and processing. Check whether the account number and password are correct: First, confirm whether the account number and password you entered are correct. When logging in, make sure the capitalization is correct and the password is

Discuz Editor: An efficient post layout tool. With the development of the Internet, online forums have become an important platform for people to communicate and share information. In the forum, users can not only express their opinions and ideas, but also discuss and interact with others. When publishing a post, a clear and beautiful format can often attract more readers and convey more accurate information. In order to facilitate users to quickly type and edit posts, the Discuz editor came into being and became an efficient post typesetting tool. Discu
