UPB v2.0 Configuration System
From MyUPBWiki
Notes about the required update: Add to Config Org. List needs to be updated UPB v2.0's Configuration System (which is the equivelent to admin_config.php & admin_config2.php), is highly complicated, and it's easy to become confused and accidentally mess up your configuration organization list.
The new Configuration System centralizes the old system's 4 files (admin_config.php, admin_configdo.php, admin_config2.php, and admin_config2do.php), into 2 files: admin_config.php and config.class.php). admin_config.php displays the editing forms to edit. config.class.php contains the config class that communicates to the config tables in the main database. The config.class.php edits and retrieves UPB's Globals. (Please note that actual code that initiates the config.class.php is in func.class.php.)
UPB's three global variable trees are $_CONFIG, $_STATUS, and $_REGISTER (or $_REGIST). $_CONFIG holds the most general variables that are used widely throughout the PHP files. $_STATUS contains the variables for assigning "ranks" and "titles" of users, which are displayed on viewtopic.php and viewpm.php, under the user's avatar. $_REGISTER, as the name implies, deals with registering users, such as the registeration e-mail. If you are familiar with the old system's variable names, you can easily learn the new system. For example with the old sytem: $homepage, the new: $_CONFIG["homepage"]. Hopefully, this will also prevent confusion, because "$_CONFIG" is easily recognizable as something "global" or needed throughout the forum, whereas the term "$homepage" is not as identifyable as such.
Contents |
Configuration Organization List
Summary:Because of the versitility of the new code and the ability to add new variables to UPB's globals without the risk of losing data or creating code conflicts (if done CORRECTLY!), the actual task of adding a variable is pretty simple. However, once you successfully add the variable, there is no risk of unintentionally losing that variable. This can be useful when applying modifications. Any new variables can be added into the Config tables with a script, and is kept safely with the others, and retrieved normally like other variables of UPB's Globals.
Raw Config. Org. List
This is what is written when UPB v2.0 is installed/upgraded, in it's PHP coded form.
"config".chr(30)."Main Configuration Settings".chr(31).
"status".chr(30)."Members' Statuses Settings".chr(31).
"regist".chr(30)."Newly Registered Members Settings".chr(31).
chr(29).
"config".chr(30)."1".chr(30)."Main Forum Config".chr(31).
"status".chr(30)."2".chr(30)."Member status".chr(31).
"status".chr(30)."3".chr(30)."Moderator status".chr(31).
"status".chr(30)."4".chr(30)."Admin Status".chr(31).
"status".chr(30)."5".chr(30)."Member status Colors".chr(31).
"status".chr(30)."6".chr(30)."Who's Online User Colors".chr(31).
"regist".chr(30)."7".chr(30)."New Users' Confirmation E-mail".chr(31).
"regist".chr(30)."8".chr(30)."Users' Avatars".chr(31)
You see a set of records separated with chr()s. The most noticable probably chr(29).
Before chr(29)
If you type into the address bar: http://www.yoursite.com/forum/admin_config.php, you do not intially get rows and columns of fields with values. You get a list. An unmodified v2.0 should give you three links: "Main Configuration Settings", "Members' Statuses Settings", and "Newly Registered Members Settings" (Respectively, they are $_CONFIG, $STATUS, and $REGIST). If you look at the text before the chr(29), it contains the raw form of the list on admin_config.php, and editing it has a direct effect on that list. So, if you wanted to add a modification that required the use of a whole new "type" ("type", when used about the Configuration System referrs to UPB's Globals or Config Variables) of variables, you would add them here. Note: The config tables only hold a 6 character value for UPB's Globals (hence why "register" is shortened to "regist". And that just by adding new data here does NOT mean you have established a new set of UPB's Globals.
After chr(29)
Essentially, these are "subcategories" for the config. If you view admin_config.php?action=status, you will notice the subcategories. Before the first chr(30), you put to which UPB Global it belongs to. Between the chr(30)'s is the order of the subcategories. To lessen confusion, do not use a number more than once even if they have two different UPB's Globals. If you want to place a new subcategory between two existing subcategories, you will need to increase by one of all subcategories' sort number after the new subcategory's place. Having the subcategories in order in the file doesn't matter so long as there are no dublicate or missing sorting numbers. Finally, after the last chr(30) is the name of the subcategory.
Tutorial of Adding to the Config. Org. List
<-- Add info here -->
Configuration Tables
There are two configuration tables in the main database: "config", and "config_ext". "config_ext" contains the field information needed in forms. It holds information such as what text to display to the left of the form ojbect to the type of form object. It also contains the variable name and value. The table "config" is a much simplier version of "config_ext", which only holds the variable name and value. "config_ext" is only used for admin_config.php.
