-
Notifications
You must be signed in to change notification settings - Fork 7
Developer Notes
RedDragonWebDesign edited this page Nov 3, 2020
·
27 revisions
If you are interesting in adding to or editing the BlueThrust5 code, here are some notes.
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
??
- Variable Types In Function Parameters
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.
- 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)
- Whenever you add or edit a function, please add variable types. Instead of
function setDebugMode($value)
, please dofunction 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()
overinclude()
andrequire()
. Prevents hard to debug double include errors.
- Lots of JQuery modal windows.
- Each database table has a class, that extends
Basic
.Basic
provides both SQL functions and form validation functions.BasicOrder
andBasicSort
may be used as an in-between class. - Looks like he wrote his own CAPTCHA system from scratch. Code located at
images/captcha.php
The code in this project is workable. I was able to patch in the things my client wanted. Some good things:
- These scripts score well on speed tests. 85ish on Google PageSpeed Insights.
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 calls tend to use a
$mysqli
class. We should look into moving towards PDO. - Uses a lot of SQL queries. Typically over 100 per page.
Take a look at this wiki / the sidebar on the right for more developer notes.