Skip to content

Developer Notes

RedDragonWebDesign edited this page Sep 5, 2020 · 27 revisions

If you are interesting in adding to or editing the BlueThrust5 code, here are some notes.

PHP Version

Our current minimum PHP version is PHP 7.0. Currently we are including the following 2 features, that are only supported by PHP 7.0, which is why I made the change.

  • Null Coalescing Operator ??
  • Function Arguments

Everyone is encouraged to run these scripts on the newest version of PHP that their server supports. Each PHP version significantly increases speed. And also each version of PHP supports new and better code syntax, which makes it easier to code.

Tips

  • You can turn on Debug Mode in My Account -> Administrator Options -> Website Settings -> Debug Mode. Debug mode on will do PHP error_reporting(E_ALL)

Guidelines

  • Whenever you add or edit a function, please add variable types. Instead of function setDebugMode($value), please do function setDebugMode(bool $value): void. This helps with tooltips and with bug catching.
  • Try not to change the database schema. Changes to the database schema risk breaking backwards compatibility, and may require changing installer code.
  • Try not to change themes. Modifying a theme requires changing all 29 of them.
  • If you write an SQL query, don't forget to include $dbprefix. Instead of "SELECT member_id FROM members WHERE loggedin = '1' AND rank_id != '1' AND disabled != '1'", need to write "SELECT member_id FROM ".$dbprefix."members WHERE loggedin = '1' AND rank_id != '1' AND disabled != '1'"
  • Don't use ?>, and delete it when you find it, unless it's necessary. Prevents hard to debug whitespace errors.
  • Prefer require_once() over include() and require(). Prevents hard to debug double include errors.

Architecture

  • Lots of JQuery modal windows.
  • Each database table has a class, that extends Basic. Basic provides both SQL functions and form validation functions. BasicOrder and BasicSort may be used as an in-between class.

State of the code

The code in this project is workable. I was able to patch in the things my client wanted. But there are several areas that need modernization:

  • Was designed for PHP 5. Huge number of notices and warnings when running on PHP 7.4
  • Does not follow MVC (Model View Controller). MVC is the excellent practice of separating SQL, HTML, and PHP into different files.
  • Many skins, but the skins are not mobile friendly.
  • Database functions tend to use a $mysqli class. We should probably move toward PDO.

Variables & Constants

  • $MAIN_ROOT - Folder that contains the website. For example, /BlueThrust5/
  • $dbprefix - SQL table prefix, if used.

Menu Section Numbers

Rank Numbers

  • Administrators can't be seen because their rankcategory_id = 3, and that rankcategory_id doesn't exist. To make an administrator visible, make a category for them and put them in it.
  • rank_id is both rank and permissions.
  • color - not used. rankcategory table has the colors.
  • hiderank - hides the rank on the ranks page only, members with that rank still show up in other places
  • autodisable - not DSL (days since login) related. Rather, it's a different feature. It'll disable you for failure to get promoted within X autodisable days.

SQL Tables (101 Tables)

  • app_captcha
  • app_components
  • app_selectvalues
  • app_values
  • clocks
  • comments
  • console
  • consolecategory
  • console_members
  • customform
  • customform_components
  • customform_selectvalues
  • customform_submission
  • customform_values
  • custompages
  • diplomacy
  • diplomacy_request
  • diplomacy_status
  • downloadcategory
  • downloads
  • download_extensions
  • eventchat
  • eventchat_messages
  • eventchat_roomlist
  • eventmessages
  • eventmessage_comment
  • eventpositions
  • events
  • events_members
  • failban - This is a throttle for the pin # required in Add Console Option, Edit Console Option, and Edit Theme. It is not a throttle for regular login.
  • forgotpass
  • forum_attachments
  • forum_board
  • forum_category
  • forum_memberaccess
  • forum_moderator
  • forum_post
  • forum_rankaccess
  • forum_topic
  • forum_topicseen
  • freezemedals_members
  • gamesplayed
  • gamesplayed_members
  • gamestats
  • gamestats_members
  • hitcounter
  • iarequest
  • iarequest_messages
  • imageslider
  • ipban
  • logs
  • medals
  • medals_members
  • memberapps
  • members
  • membersonlypage
  • menuitem_customblock
  • menuitem_custompage
  • menuitem_image
  • menuitem_link
  • menuitem_shoutbox
  • menu_category
  • menu_item
  • news
  • notifications
  • plugins
  • plugin_config
  • plugin_pages
  • polls
  • poll_memberaccess
  • poll_options
  • poll_rankaccess
  • poll_votes
  • privatemessages
  • privatemessage_folders
  • privatemessage_members
  • profilecategory
  • profileoptions
  • profileoptions_select
  • profileoptions_values
  • rankcategory
  • ranks
  • rank_privileges
  • social
  • social_members
  • squadapps
  • squadinvites
  • squadnews
  • squadranks
  • squads
  • squads_members
  • tableupdates
  • tournamentmatch
  • tournamentplayers
  • tournamentpools
  • tournamentpools_teams
  • tournaments
  • tournamentteams
  • tournament_connect
  • tournament_managers
  • websiteinfo
Clone this wiki locally