using discuz


Discuz is an open source software, we use this software to manage the forum, we will briefly present the organizational structure of the discuz code for those who need it for reference. , ,

1.discuz directory structure

Directory structure:

/api
Uc.php uCenter Communication File
       / api / addons Application Center
       / api / connectTencent
       / api / GoogleGoogle engine interface processing
       / api / jаvascript JS calling data and advertising
       / api / manyoumanyou application and related services search
     / api / remote update?
     / api / trade Alipay, Tenpay and other transaction interfaces
     / Forum Archive Static Archiver
/ config program configuration file
       The configuration file of the main parameters of the forum config_global.php
       configuration file of the main parameters config_ucenter.phpUCenter
       The configuration file of the main parameters of the forum config_global_default.php (example)
Configuration file of the main parameter config_ucenter_default.phpUCenter (example)
/ data attachments, database and file cache
/ install installer
/ source / Catalog of processing functions of the software module
 /discuz_version.php program version number storage file
/ source / admincp background management for viewing directory file labels
 / source / archiver Forum Archiver static program directory View file annotations
/ source / include directory processing program functions
/ source / language program language package (if unclear, please open each file to view) view the label of the directory file
/ source / module program functional module package view the label of the directory file
/ source / plugin module extension directory for viewing directory file labels
/ source / functionDX library of custom functions for viewing directory file labels
 / source / classCore class library for viewing the annotation of the directory file
/ template template directory for viewing the label of the directory file
/ UC_Client uCenter client
/ uc_server uCenter server
/ static storage of attachments of program interface elements
 Root Directory file
 Background input file admin.php
Collaboration API
api.php Forum archiver Archiver in reading mode (without a plate)
the file of the cloud platform interface
connect.php Multi-application service record file cp.php (download userapp.php )
crossdomain.xml
 ficocon.ico ICO icon website
 forum.php the file with the forum channel
 group.php group channel recording file
 Home.phphome channel login file
index.php home page
 User login file member.php (login, registration, exit, etc.)
program misc.php different extension entries
plugin.php plugin
input file portal.php portal entry file
 File search engine restrictions
robots.txt search.php log in to the search channel
 Multi-application service record file userapp.php



2. Code flow structure analysis

First, set up the homepage and the route recorded in each section in nginx

The home page is redirected to by default index.php

The search page is sent to search.php

The Personal Center is directed to home.php

The backend of the forum is directed to admin.php

The section page is sent to forum.php

These files have require_once './source/class/class_core.php ', this file is a call to the configuration file in the conf section, connects to the database, checks the login status, receives information about the login user, receives data from the cache data table, Wait, the following code is the initialization process: (a specific operation is interested in its own research)

C::app()->cachelist = $cachelist;

C::app()->init();

loadforum();

set_rssauth();

runhooks();

After initializing the input function, the task will be distributed according to the url parameter.

Take it forum.php as an example, the download requires DISCUZ_ROOT. '. / Source / module / forum / forum _'. $ Mod. '. Php' according to the mod parameters.

 

forum.php (initialization) --------> source (processing) ------> template (page display)

 

Equivalent to the logic of the MVC layer

 

  

============= But the main discuz processing module is located in the source directory ==========================

 

The structure of the source code is shown in Figure 1 below

 

1. Source/Class database table operation

 

C :: t ('forum_forum') -> fetch ($ _ G ['fid']); The change function is a database operation that is equivalent to getting information about a tablet. The specific database code is a sampling function in source / class / table / table_forum_forum.php Or in the parent class

 

2.catalog of processing functions of the original/included program

 

The module is divided depending on the function

 

Form loading example: require_once libfile ('post / newthread', 'include');

 

This module is responsible for processing publishing tasks

3. library of custom source functions/functions

 

The module is global and does not belong to a specific module.

 

Example of the upload form: include template ('diy: forum / viewthread'. $ Sufix. ':'. $ _ G ['fid']);

 

 

When all the functions are processed and the html page needs to be loaded, the above sentence will be executed.The template function is in function_core.php , and the information about the loaded page is determined according to the parameters.

 

4. source / language program language pack

 

The lang() function in function_core.php finds the corresponding value according to the passed parameters

 

 

5. Plugin extension directory for source code/plugin

 

API request, every time coins, etc., disk or other code written by others, can be put here in the form of plugins

 

Diskuz background principle of operation

 

admin.php : this is an input file for background management, basically it performs two functions: initialization, basic processing

Distribute tasks by the action parameter

1. If the action does not exist, call $admincp-> show_admincp_main ();

Go to the requirement './source/admincp/admincp_main.php ';

 

2. If the action exists, return './source/admincp/admincp_'.$action.'.php';

 

$action is empty: admincp_main.php : get a menu to display
 

 

 

 

<!--[if ppt]--><!--[endif]-->
<!--[if ppt]--><!--[endif]-->
 

$ action is not empty: admincp _ '. $action.'. php, determine which operation you want to perform based on $operation, enter the appropriate page






Go back
16-11-2022, 13:09