-
Notifications
You must be signed in to change notification settings - Fork 9
Useful Functions, Constants, Variables
RedDragonWebDesign edited this page Nov 2, 2020
·
17 revisions
-
Basic->get_info_filtered()- Sanitizes HTML. Similar tohtmlspecialchars() -
$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 are always global. define() to set, if ( defined() ) to check.
ADMIN_KEY-
BASE_DIRECTORY- by way ofdefine("BASE_DIRECTORY", $BASE_DIRECTORY);in _setup.php CAMPAIGN_FORMCONVERT_WEBSITEINFOEDIT_FOLDERFORUMACTIVITY_MENUITEMFULL_SITE_URLHPIMAGE_FORMLOGGED_IN-
MAIN_ROOT- by way ofdefine("MAIN_ROOT", $MAIN_ROOT);in _setup.php MANAGEMENU_FUNCTIONSMEMBERRANK_IDNEWMEMBERS_MENUITEMPOSTNEWS_FORMPREVENT_HACKRESIZE_FORUM_IMAGESSHOW_ACCESSCACHESHOW_BANLISTSHOW_EDITPOLLSHOW_FORUMPOSTSHOW_FORUMSEARCHSHOW_MANAGERLISTSHOW_POLLLISTSHOW_PROFILE_MAINSHOW_SEARCHRESULTSSHOW_SHOUTBOXLISTSHOW_UNASSIGNEDPLAYERSSOCIALMEDIA_FORMTHEME
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']
- Example:
-
$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']
- Example:
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- Equalshttporhttps $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
$COOKIE_EXP_TIME$debug$EXTERNAL_JAVASCRIPT$SHOUTBOX_RELOAD_MS$sqlCache$SQL_CACHE_ENABLED$SQL_PROFILER$VERSION