Important $w Array Update

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000048956

As of November 1, 2018, several configuration values previously available in the $w array were moved to the brilliantDirectories::getDatabaseConfiguration() static method to improve security.

Any custom code that references these configuration values should be updated to use the new method.

Affected Configuration Keys

The following keys are no longer available through the $w array:

  • website_user
  • website_pass
  • database_user
  • database_pass
  • database_host
  • database
  • database_directory_user
  • database_directory_pass
  • whmcs_database_host
  • whmcs_database_user
  • whmcs_database_password
  • whmcs_database_name
  • whmcs_api_password
  • whmcs_api_host
  • whmcs_api_username

Updating Existing Code

The brilliantDirectories::getDatabaseConfiguration() method accepts the configuration key as its only parameter and returns the corresponding value.

Replace references to configuration values in the $w array with calls to the new static method.

Example 1

Replace either of the following:

$w['website_user']

or

$w[website_user]

with:

brilliantDirectories::getDatabaseConfiguration('website_user')

Example 2

Original code:

$membersQuery = mysql($w['database'], "SELECT
    *
FROM
    `users_data`");

Updated code:

$membersQuery = mysql(
    brilliantDirectories::getDatabaseConfiguration('database'),
    "SELECT
        *
    FROM
        `users_data`"
);

Summary

Whenever custom code needs access to one of the affected configuration values, replace the corresponding $w array reference with a call to (where configuration_key is the name of the desired configuration value)

brilliantDirectories::getDatabaseConfiguration('configuration_key')