First, all here will be described relative to the installed folder of DTC (in /usr/share/dtc in most Linux, and in /usr/local/www/dtc in FreeBSD).
1. General organization
It might be obvious but still...
- /admin holds the files needed only for the root control panel in http://www.example.com/dtcadmin/, that you don't want to share for customers (for security reasons). It also has the files for the cron job.
- /client holds the files for the client interface in http://www.example.com/dtc/
- /email holds the files for the in http://www.example.com/dtcemail/
- /shared holds the files shared by both the client and the root control panel. This is where most of the code is.
In the following text, we'll have a deeper look on each of them
2. Deeper look in dtc/admin
There is not much to see here, it's fast to discover it. Even if there is a lot of files, only a few are interesting. Here they are:
- index.php This one is currently a bit messy, but it does mainly call to other files. Still some parts are fully written in there
- daemons_state.php This one (and it's string file) is shown in the daemon monitor of DTC (in the iframe)
- accesslog.php This is a cron job started each day that will dump each vhost log from mysql, and call webalizer. Each month it also collect the datas of each days into a unic big file, and remove the archives older than one year.
- cron.php This is where all the files are generated and daemon restarted. It call the scripts in the dtc/admin/genfiles folder
- inc/nav.php This is where you have the drawing of the user list and the big icons on the top of the root panel
- inc/dtc_config.php This one has all the functions to draw the forms of the "general configuration" of the root panel
- inc/img.php draws the user menu (tree view)
- inc/submit_root_querys.php Most functions needing a custom SQL query and other things (like VPS creation, renewl and pending user validation) is done here. This is a very important file. Note that as the root user is supposed to be a TRUSTED user, fewer feild input checkings is done here. If somebody wants to add more checks, feel free to do so.
- dtcrm/product_manager.php had the product manager form
- dtcrm/submit_to_sql.php contains old code (unused) that should be removed
3. Deeper look into dtc/client
There are quite some frontal files in there, it's needed that they are all in the root directoy. Here's the big list:
- enets-notify.php, secpaycallback_worldpay.php, paypal.php are all called by payment servers to validate a payment.
- index.php calls mainly login_form() (the form is in login.php) and drawAdminTools() (located in dtc/shared/inc/draw.php)
- inc/ folder is not important, there is only the tree view draw function img.php and some picture files
The rest is mainly in dtc/shared/inc that we are about to see... right NOW!
4. Deeper look into dtc/shared
- dtc_lib.php has a list of included files for all the 3 panels (root, client and email)
- dtc_version.php and mysql_config.php are setup by the installer with version and mysql connect info respectively
- The drawlib/ folder has many utility functions that are:
- anotherDtc.php some function for layout
- skin.php contains the tree view (and not skin functions anymore)
- skinLib.php contains the new skin functions
- tree_menu.php a cleaner version of the tree view that is really recursive but not yet used (the other version allow only one level in the tree view)
- cc_code_popup.php Some array with country codes VS country names, country included in the EU (used for billing)
- dtc_functions.php Has many many functions, you should have a look. Many field checkings are done in it (using regular expressions)
- templates.php is a very important file that does the drawing of most forms and does SQL for them as well. A special chapter will be written here soon about it.
- default_admin_site.php, 404_template and template are used only durring the setup (and copied ONCE at the FIRST installation of the panel ONLY)
- securepay contains the payment API and modules
- dtcrm/ folder contains the registrar API modules (Tucows, and partial implementation of webnic)
- vars/global_vars.php contains input checkings for the (very few) global variables of the panel like $rub (which is the chapter, if you like more, checkings are needed to avoid XSS on the client login screen), $adm_login, $adm_pass, $addrlink (address in the treeview of the user interface)
- inc/ is where you will find the most of the user panel. See the following chapter
- inc/draw.php is the file that will draw the customer interface (tree view and so on). It is where all the inc/forms file are included, and where it calls functions defined in inc/forms.
- inc/submit_to_sql.php has all the scripts for sending your forms query to SQL and execute the needed shell commands (create subdirs, and so on). It also includes files in the inc/sql folder. Note that with current CVS some forms don't need to have a file in inc/sql as they use the template engine that does the SQL for you.
- inc/forms and inc/sql All the entries of the tree view menu of the user interface is there. Each of them has an entry in forms that will draw, and all forms input are then processed in inc/sql. See each of the file names in it, it's rather self explanatory.