Skip to content

Useful Functions, Constants, Variables

RedDragonWebDesign edited this page Nov 2, 2020 · 17 revisions

Functions

  • Basic->get_info_filtered() - Sanitizes HTML. Similar to htmlspecialchars()
  • $mysqli->query() - The preferred way of querying the database if you are not using a class.
  • $this->MySQL->get_tablePrefix() - SQL table prefix, if used.

Constants

Constants are always global. define() to set, if ( defined() ) to check.

  • ADMIN_KEY
  • BASE_DIRECTORY - by way of define("BASE_DIRECTORY", $BASE_DIRECTORY); in _setup.php
  • CAMPAIGN_FORM
  • CONVERT_WEBSITEINFO
  • EDIT_FOLDER
  • FORUMACTIVITY_MENUITEM
  • FULL_SITE_URL
  • HPIMAGE_FORM
  • LOGGED_IN
  • MAIN_ROOT - by way of define("MAIN_ROOT", $MAIN_ROOT); in _setup.php
  • MANAGEMENU_FUNCTIONS
  • MEMBERRANK_ID
  • NEWMEMBERS_MENUITEM
  • POSTNEWS_FORM
  • PREVENT_HACK
  • RESIZE_FORUM_IMAGES
  • SHOW_ACCESSCACHE
  • SHOW_BANLIST
  • SHOW_EDITPOLL
  • SHOW_FORUMPOST
  • SHOW_FORUMSEARCH
  • SHOW_MANAGERLIST
  • SHOW_POLLLIST
  • SHOW_PROFILE_MAIN
  • SHOW_SEARCHRESULTS
  • SHOW_SHOUTBOXLIST
  • SHOW_UNASSIGNEDPLAYERS
  • SOCIALMEDIA_FORM
  • THEME

Global Variables

Need to use global keyword to access these inside a function or class.

These two are used a lot:

  • $MAIN_ROOT - Relative web path that is required for URL's in HTML and JS, and for setting cookie paths. Should start and end with a slash.
    • Example: echo '<a href="'.$MAIN_ROOT.'members/index.php">My Account</a>';
    • $MAIN_ROOT = "/BlueThrust5%20R17/src/";
    • $_SERVER['REQUEST_URI']
  • $BASE_DIRECTORY - Absolute server path that is required when using PHP functions. Should end with a slash. On Linux, should start with a slash. On Windows, uses forward slashes.
    • Example: require_once($BASE_DIRECTORY.'members/index.php');
    • $BASE_DIRECTORY = "D:/Dropbox/Code/BlueThrust5 R17/src/";
    • $_SERVER['SCRIPT_FILENAME']

Here's some others. I created this list by searching for the global keyword. Many of these should be refactored to function parameters instead of using the global keyword.

  • $arrAfterJS
  • $arrGames
  • $arrItemTypeChangesJS
  • $arrRecurUnits
  • $arrSocialMediaInfo
  • $arrTournaments
  • $blnCheckForumAttachments
  • $blnPostReply
  • $boardObj
  • $breadcrumbObj
  • $btThemeObj
  • $campaignInfo
  • $cID
  • $clockObj
  • $dbprefix - SQL table prefix, if used
  • $dispHTTP - Equals http or https
  • $donationPlugin
  • $filterBoardOptions
  • $formObj
  • $gameMemberObj
  • $gameObj
  • $gameStatsObj
  • $GLOBALS['autolink_options']
  • $GLOBALS['menu_item_info']
  • $GLOBALS['news_post']
  • $GLOBALS['returnArr']
  • $GLOBALS['richtextEditor']
  • $GLOBALS['rtCompID']
  • $hasAwardMedalAccess
  • $hooksObj
  • $imageOptionComponents
  • $ipbanObj
  • $IP_ADDRESS
  • $i
  • $linkOptionComponents
  • $medalObj
  • $memberAppInfo
  • $memberGameStatObj
  • $memberInfo
  • $member
  • $menuItemObj
  • $mysqli
  • $newsObj
  • $PAGE_NAME
  • $pluginObj
  • $pollOptionComponents
  • $postInfo
  • $prevFolder - Example: ../../
  • $setPostsPerPage
  • $signUpForm
  • $siteDomain
  • $THEME
  • $topicInfo
  • $tournamentObj
  • $webInfoObj
  • $websiteInfo

Global Variables I Added

  • $COOKIE_EXP_TIME
  • $debug
  • $EXTERNAL_JAVASCRIPT
  • $SHOUTBOX_RELOAD_MS
  • $sqlCache
  • $SQL_CACHE_ENABLED
  • $SQL_PROFILER
  • $VERSION
Clone this wiki locally