Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -39,6 +39,26 @@ class IPS
|
||||
* @brief Vendors to use PSR-0 autoloader for
|
||||
*/
|
||||
public static $PSR0Namespaces = array();
|
||||
|
||||
/**
|
||||
* @brief Community in the Cloud configuration
|
||||
*/
|
||||
public static $cicConfig = array();
|
||||
|
||||
/**
|
||||
* @brief IPS Applications
|
||||
*/
|
||||
public static $ipsApps = array(
|
||||
'blog',
|
||||
'calendar',
|
||||
'cms',
|
||||
'core',
|
||||
'downloads',
|
||||
'forums',
|
||||
'gallery',
|
||||
'nexus',
|
||||
'convert'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get default constants
|
||||
@@ -47,85 +67,457 @@ class IPS
|
||||
*/
|
||||
public static function defaultConstants()
|
||||
{
|
||||
$storeMethod = 'FileSystem';
|
||||
$storeConfig = '{"path":"{root}/datastore"}';
|
||||
$cacheMethod = 'None';
|
||||
$cacheConfig = '{}';
|
||||
$redisConfig = NULL;
|
||||
$redisEnabled = FALSE;
|
||||
$outputCache = 'Database';
|
||||
$outputCacheConfig = NULL;
|
||||
$guestTimeout = 30;
|
||||
|
||||
if ( isset( self::$cicConfig['redis-guest-cache'] ) and self::$cicConfig['redis-guest-cache'] == 'on' )
|
||||
{
|
||||
$outputCache = 'Redis';
|
||||
$guestTimeout = 900;
|
||||
}
|
||||
|
||||
if ( isset( self::$cicConfig['guest_cache_timeout'] ) and self::$cicConfig['guest_cache_timeout'] and \is_numeric( self::$cicConfig['guest_cache_timeout'] ) )
|
||||
{
|
||||
$guestTimeout = \intval( self::$cicConfig['guest_cache_timeout'] );
|
||||
}
|
||||
|
||||
if ( isset( self::$cicConfig['redis'] ) and \is_array( self::$cicConfig['redis'] ) )
|
||||
{
|
||||
$storeMethod = 'Redis';
|
||||
$cacheMethod = 'Redis';
|
||||
$redisEnabled = TRUE;
|
||||
|
||||
$redisConfig = json_encode( self::compileCicRedisConfig() );
|
||||
}
|
||||
else if ( isset( $_SERVER['IPS_CIC'] ) )
|
||||
{
|
||||
$guestTimeout = ( $guestTimeout == 30 ) ? 300 : $guestTimeout;
|
||||
|
||||
$storeMethod = 'Database';
|
||||
$storeConfig = '{}';
|
||||
$cacheMethod = 'None';
|
||||
$cacheConfig = '{}';
|
||||
}
|
||||
$sitePath = __DIR__;
|
||||
if ( isset( $_SERVER['IPS_CIC'] ) )
|
||||
{
|
||||
if ( isset( $_SERVER['IPS_CLOUD2'] ) AND isset( $_SERVER['IPS_CLOUD2_ID'] ) )
|
||||
{
|
||||
$uniqueKey = $_SERVER['IPS_CLOUD2_ID'];
|
||||
$sitePath = "/var/www/sitefiles/{$_SERVER['IPS_CLOUD2_ID']}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$uniqueKey = preg_match( '/^\/var\/www\/html\/(.+?)$/i', __DIR__, $matches ) ? str_replace( '/', '', $matches[1] ) : mb_substr( md5( 'abf7b' . '$Rev: 3023$'), 10, 10 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$uniqueKey = mb_substr( md5( '13_mafia' . '$Rev: 3023$'), 10, 10 );
|
||||
}
|
||||
|
||||
// ==========================================================================================
|
||||
// Default system constants. Any of these can be modified by defining them in a constants.php
|
||||
// file placed in the root directory (doing this allows their values to remain unchanged by
|
||||
// future upgrades)
|
||||
return array(
|
||||
'CIC' => isset( $_SERVER['IPS_CIC'] ),
|
||||
'CP_DIRECTORY' => 'admin',
|
||||
'IN_DEV' => FALSE,
|
||||
'DEV_USE_WHOOPS' => TRUE,
|
||||
'DEV_USE_FURL_CACHE' => FALSE,
|
||||
'DEV_USE_MENU_CACHE' => FALSE,
|
||||
'DEV_HIDE_DEV_TOOLS' => FALSE, // Makes IN_DEV not look like IN_DEV for the sake of doing screenshots
|
||||
'DEBUG_JS' => FALSE,
|
||||
'DEV_DEBUG_JS' => TRUE,
|
||||
'DEV_DEBUG_CSS' => FALSE,
|
||||
'DEBUG_TEMPLATES' => FALSE,
|
||||
'IPS_FOLDER_PERMISSION' => 0777,
|
||||
'FOLDER_PERMISSION_NO_WRITE' => 0755,
|
||||
'IPS_FILE_PERMISSION' => 0666,
|
||||
'FILE_PERMISSION_NO_WRITE' => 0644,
|
||||
'ROOT_PATH' => __DIR__,
|
||||
'NO_WRITES' => ( isset( $_SERVER['IPS_CIC'] ) and !isset( $_SERVER['IPS_CIC_ACP'] ) ),
|
||||
'DEBUG_LOG' => FALSE,
|
||||
'LOG_FALLBACK_DIR' => '{root}/uploads/logs',
|
||||
'STORE_METHOD' => ( isset( $_SERVER['IPS_CIC'] ) ? 'Database' : 'FileSystem' ),
|
||||
'STORE_CONFIG' => '{"path":"{root}/datastore"}',
|
||||
'CACHE_METHOD' => isset( $_SERVER['IPS_CLOUD_REDIS425'] ) ? 'Redis' : 'None',
|
||||
'CACHE_CONFIG' => isset( $_SERVER['IPS_CLOUD_REDIS425'] ) ? '{ "server": "' . $_SERVER['IPS_CLOUD_REDIS425'] . '", "port": 6379 }' : '{}',
|
||||
'CACHE_PAGE_TIMEOUT' => ( isset( $_SERVER['IPS_CIC'] ) ? 300 : 30 ),
|
||||
'TEST_CACHING' => FALSE,
|
||||
'EMAIL_DEBUG_PATH' => NULL,
|
||||
'BULK_MAILS_PER_CYCLE' => 50,
|
||||
'JAVA_PATH' => "",
|
||||
'ERROR_PAGE' => 'error.php',
|
||||
'UPGRADING_PAGE' => ( defined( 'CP_DIRECTORY' ) ) ? CP_DIRECTORY . '/upgrade/upgrading.html' : 'admin/upgrade/upgrading.html', # defined call here just as a sanity check
|
||||
'QUERY_LOG' => FALSE,
|
||||
'CACHING_LOG' => FALSE,
|
||||
'ENFORCE_ACCESS' => FALSE,
|
||||
'THUMBNAIL_SIZE' => '500x500',
|
||||
'PHOTO_THUMBNAIL_SIZE' => 240, // The max we display is 120x120, so this allows for double size for high dpi screens
|
||||
'COOKIE_DOMAIN' => NULL,
|
||||
'COOKIE_PREFIX' => 'ips4_',
|
||||
'COOKIE_PATH' => NULL,
|
||||
'COOKIE_BYPASS_SSLONLY' => FALSE,
|
||||
'CONNECT_NOSYNC_NAMES' => FALSE,
|
||||
'BYPASS_CURL' => FALSE,
|
||||
'FORCE_CURL' => FALSE,
|
||||
'NEXUS_TEST_GATEWAYS' => FALSE,
|
||||
'NEXUS_LKEY_API_DISABLE' => TRUE,
|
||||
'NEXUS_LKEY_API_CHECK_IP' => TRUE,
|
||||
'NEXUS_LKEY_API_ALLOW_IP_OVERRIDE' => FALSE,
|
||||
'UPGRADE_MANUAL_THRESHOLD' => 250000,
|
||||
'SUITE_UNIQUE_KEY' => ( isset( $_SERVER['IPS_CIC'] ) and preg_match( '/^\/var\/www\/html\/(.+?)$/i', __DIR__, $matches ) ) ? str_replace( '/', '', $matches[1] ) : mb_substr( md5( '13_mafia' . '$Rev: 3023$'), 10, 10 ),
|
||||
'CACHEBUST_KEY' => mb_substr( md5( '13_mafia' . '$Rev: 3023$'), 10, 10 ), // This looks unnecessary but SUITE_UNIQUE_KEY can be set to a constant constant in constants.php whereas we need a version specific constant for cache busting.
|
||||
'TEXT_ENCRYPTION_KEY' => NULL,
|
||||
'CONNECT_MASTER_KEY' => NULL,
|
||||
'USE_DEVELOPMENT_BUILDS' => FALSE,
|
||||
'DEV_WHOOPS_EDITOR' => NULL,
|
||||
'DEFAULT_REQUEST_TIMEOUT' => 10, // In seconds - default for most external connections
|
||||
'LONG_REQUEST_TIMEOUT' => 30, // In seconds - used for specific API-based calls where we expect a slightly longer response time
|
||||
'TEMP_DIRECTORY' => sys_get_temp_dir(),
|
||||
'TEST_DELTA_ZIP' => '',
|
||||
'TEST_DELTA_TEMPLATE_CHANGES' => '',
|
||||
'DELTA_FORCE_FTP' => FALSE,
|
||||
'BYPASS_ACP_IP_CHECK' => FALSE,
|
||||
'RECOVERY_MODE' => FALSE,
|
||||
'DEV_FORCE_MFA' => FALSE,
|
||||
'DISABLE_MFA' => FALSE,
|
||||
'BOT_SEARCH_FLOOD_SECONDS' => 30,
|
||||
'READ_WRITE_SEPARATION' => TRUE,
|
||||
'USE_MYSQL_SEARCH_BASIC_MODE_THRESHOLD' => 0,
|
||||
'UPGRADE_MD5_CHECK' => TRUE,
|
||||
'BYPASS_UPGRADER_LOGIN' => FALSE,
|
||||
'OAUTH_REQUIRES_HTTPS' => TRUE,
|
||||
'REDIS_LOG' => FALSE,
|
||||
'REDIS_ENABLED' => 0,//isset( $_SERVER['IPS_CLOUD_REDIS425'] ),
|
||||
'REDIS_ENCRYPT' => TRUE,
|
||||
'NOTIFICATIONS_PER_BATCH' => 30,
|
||||
'SHOW_ACP_LINK' => TRUE,
|
||||
'REPORT_EXCEPTIONS' => FALSE,
|
||||
'DEFAULT_THEME_ID' => 1,
|
||||
'HTMLENTITIES' => ENT_DISALLOWED, // @deprecated and will be removed in 4.4
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// GENERAL OPTIONS: CAN BE CHANGED
|
||||
// We would like to make these "actual" settings but we need their values before doing
|
||||
// any other initialisation.
|
||||
|
||||
// Use beta releases?
|
||||
// If enabled, the upgrader in the AdminCP will prompt you to upgrade to beta releases
|
||||
// in addition to normal releases.
|
||||
'USE_DEVELOPMENT_BUILDS' => FALSE,
|
||||
|
||||
// Recovery mode
|
||||
// Will turn off third party customisations if one is causing an issue that prevents
|
||||
// accessing the AdminCP. See https://remoteservices.invisionpower.com/docs/recovery_mode
|
||||
'RECOVERY_MODE' => FALSE,
|
||||
|
||||
// Disable two-factor authentication?
|
||||
// Can be used if you ever lock yourself out of your account
|
||||
'DISABLE_MFA' => FALSE,
|
||||
|
||||
// Error page
|
||||
// If a really bad error occurs, this is our final fallback for what to show. You can
|
||||
// change it if you want to translate or otherwise customise it.
|
||||
'ERROR_PAGE' => 'error.php',
|
||||
|
||||
// Upgrading page
|
||||
// Is shown when upgrade is in process. You can change it if you want to translate
|
||||
// or otherwise customise it.
|
||||
'UPGRADING_PAGE' => ( \defined( 'CP_DIRECTORY' ) ) ? CP_DIRECTORY . '/upgrade/upgrading.html' : 'admin/upgrade/upgrading.html',
|
||||
|
||||
// Disable login for the upgrader?
|
||||
// The upgrader can only use the standard login handler so if you have turned that off
|
||||
// and are using entirely a different login handler, you'll need to enable this so you
|
||||
// can access the upgrader. See https://remoteservices.invisionpower.com/docs/upgrader_login_help
|
||||
'BYPASS_UPGRADER_LOGIN' => FALSE,
|
||||
|
||||
// Commerce license key API settings
|
||||
// See https://remoteservices.invisionpower.com/docs/licenseapi
|
||||
'NEXUS_LKEY_API_DISABLE' => TRUE,
|
||||
'NEXUS_LKEY_API_CHECK_IP' => TRUE,
|
||||
'NEXUS_LKEY_API_ALLOW_IP_OVERRIDE' => FALSE,
|
||||
|
||||
// Encryption key
|
||||
// In some places we encrypt data. By default the key we use for that is based off
|
||||
// the database name and password, but that means if you ever change those, the data
|
||||
// won't be able to be read. So if you *do* change those, you can set this constant
|
||||
// to md5( old_database_pass + old_database_name ) to fix that.
|
||||
'TEXT_ENCRYPTION_KEY' => NULL,
|
||||
|
||||
// Encrypt data stored in Redis?
|
||||
// Needed in any environment where the Redis server is shared for security reasons
|
||||
'REDIS_ENCRYPT' => TRUE,
|
||||
|
||||
// Data storage / caching settings
|
||||
// To change any of the below, go to [AdminCP > System > Advanced Configuration >
|
||||
// Data storage] and follow the instructions - it will give you a new constants.php
|
||||
// file to use without messing with anything else you've changed.
|
||||
'STORE_METHOD' => $storeMethod, // Data storage method (Database, Redis or FileSystem)
|
||||
'STORE_CONFIG' => $storeConfig, // JSON-encoded settings specific to the Data storage method
|
||||
'CACHE_METHOD' => $cacheMethod, // Caching Method (Redis, Memcache, etc. "None" to disable)
|
||||
'CACHE_CONFIG' => $cacheConfig, // JSON-encoded settings specific to the caching storage method
|
||||
'CACHE_PAGE_TIMEOUT' => $guestTimeout, // Guest page caching timeout in seconds
|
||||
'REDIS_ENABLED' => $redisEnabled, // Use Redis for sessions and to topic view counters in addition to normal caching?
|
||||
'REDIS_CONFIG' => $redisConfig, // JSON-encoded settings specific to Redis
|
||||
// These ones can't be changed in the AdminCP, but it's the same idea - allows Redis to be used for caching *except* guest page caching:
|
||||
'OUTPUT_CACHE_METHOD' => $outputCache, // Caching Method for guest page caching (Redis or Database)
|
||||
'OUTPUT_CACHE_METHOD_CONFIG' => $outputCacheConfig , // JSON-encoded settings specific to the guest page caching method
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// SERVER ENVIRONMENT OPTIONS: CAN BE CHANGED IF YOU'RE 100% SURE YOU KNOW WHAT YOU'RE DOING
|
||||
// These constants normally never need to be changed (hence not settings) but sometimes
|
||||
// we come accross an unusual sever environment where that isn't the case.
|
||||
|
||||
// Disable IP address checking when validating the AdminCP sessions?
|
||||
// See https://remoteservices.invisionpower.com/docs/disable_ip_check
|
||||
'BYPASS_ACP_IP_CHECK' => FALSE,
|
||||
|
||||
// File permissions
|
||||
// For example: when making folders for files to be uploaded to, what permissions
|
||||
// that should be created with
|
||||
'IPS_FOLDER_PERMISSION' => 0777, // Writeable folders
|
||||
'FOLDER_PERMISSION_NO_WRITE' => 0755, // Non-writeable folders
|
||||
'IPS_FILE_PERMISSION' => 0666, // Writeable files
|
||||
'FILE_PERMISSION_NO_WRITE' => 0644, // Non-writeable files
|
||||
|
||||
// Log directory
|
||||
// Normally logging information gets written to the database, but if the database itself
|
||||
// is down, we fallback to writing to disk. This sets the directory to use.
|
||||
// {root} can be used for the site's root directory
|
||||
'LOG_FALLBACK_DIR' => '{root}/uploads/logs',
|
||||
|
||||
// Temp directory
|
||||
// A directory where we can throw temporary files
|
||||
'TEMP_DIRECTORY' => sys_get_temp_dir(),
|
||||
|
||||
// Cookie settings
|
||||
// The correct value for most of these are automatically detected so customising the
|
||||
// values should not be necessary except where doing very special customisations like
|
||||
// some kind of SSO integration
|
||||
'COOKIE_DOMAIN' => NULL, // The domain to set cookies to. Defaults to "specific-subdomain.domain.com" with no preceeding "."
|
||||
'COOKIE_PREFIX' => 'ips4_', // A prefix added to all cookie names to prevent conflicts
|
||||
'COOKIE_PATH' => NULL, // Path from domain to set cookies to. Defaults to wherever the community is
|
||||
'COOKIE_BYPASS_SSLONLY' => FALSE, // If site is running on https, we set cookies as "secure" (i.e. only sent in https requests) unless this is TRUE
|
||||
|
||||
// Threshold for "basic search mode"
|
||||
// Very big database tables can be very slow to search, so if a value is set here, and
|
||||
// the core_search_index table has more rows than whatever its value is, we default to
|
||||
// limiting searches to the last year
|
||||
'USE_MYSQL_SEARCH_BASIC_MODE_THRESHOLD' => 0,
|
||||
|
||||
// Maximum number of emails per batch
|
||||
// Note: changing this will have very little practical effect because the batches will just
|
||||
// get processed quicker - turning it down won't allow you to workaround server limitation
|
||||
// about how many emails can get sent. It's just to prevent sending more data to the email
|
||||
// server than it can handle in one go.
|
||||
// Has no effect on some email handlers (Sendgrid and IPS Cloud Email) which override this
|
||||
// with their own specific limits.
|
||||
'BULK_MAILS_PER_CYCLE' => 50,
|
||||
|
||||
// Maximum number of notifications to send per batch
|
||||
'NOTIFICATIONS_PER_BATCH' => 30,
|
||||
|
||||
// Maximum number of things to rebuild per cycle for background tasks
|
||||
'REBUILD_SLOW' => 50, // For routines that take a while
|
||||
'REBUILD_NORMAL' => 250, // For most routines
|
||||
'REBUILD_QUICK' => 500, // For routines that are fast
|
||||
|
||||
// Rate limit (in seconds) for bots on searching
|
||||
'BOT_SEARCH_FLOOD_SECONDS' => 30,
|
||||
|
||||
// Upgrader settings
|
||||
// When running the upgrader, if it needs to run a query against a table that matches either
|
||||
// of these conditions, it will tell you to run the query manually (i.e. at the command line)
|
||||
// rather than try to run it itself to prevent timing out
|
||||
'UPGRADE_MANUAL_THRESHOLD' => 250000, // More than this number of rows
|
||||
'UPGRADE_LARGE_TABLE_SIZE' => 100000000, // Bigger than this for what MySQL reports as "Data_length" in the table status (what the value means differs between MySQL and ISAM)
|
||||
|
||||
// cURL settings
|
||||
// BY default, we use cURL if version 7.36 or above is installed, and fallback to using
|
||||
// socket connections if not. These can change that (usually used more for testing/debugging
|
||||
// than in real-world use)
|
||||
'BYPASS_CURL' => FALSE, // This will make cURL *never* be used, even if it's installed
|
||||
'FORCE_CURL' => FALSE, // This will make cURL be used even if it is a version less than 7.36 is installed (no effect if BYPASS_CURL is TRUE)
|
||||
|
||||
// Default timeouts for cURL/socket requests
|
||||
// All values in seconds
|
||||
'DEFAULT_REQUEST_TIMEOUT' => 10, // Default where no other timeout is set
|
||||
'LONG_REQUEST_TIMEOUT' => 30, // Used for specific API-based calls where we expect a slightly longer response time
|
||||
'VERY_LONG_REQUEST_TIMEOUT' => 300, // Used for specific API-based calls where we expect a significantly longer response time
|
||||
|
||||
// "Don't Write Anything To Disk" Mode
|
||||
// Can be used for cluster environments where nothing should be written to disk.
|
||||
// Disables things like installing applications/plugins/themes and writing log files
|
||||
// The default value is to enable this for front-end of Invision Community in the Cloud
|
||||
// to disable log writing, but not in the AdminCP, so installing things is still
|
||||
// available (facilitated by `IPS::resyncIPSCloud()`)
|
||||
'NO_WRITES' => ( isset( $_SERVER['IPS_CIC'] ) and !isset( $_SERVER['IPS_CIC_ACP'] ) AND !isset( $_SERVER['IPS_CLOUD2'] ) ),
|
||||
|
||||
// How long a task is late running before the admin gets a notification
|
||||
// CiC is longer as CiC is more closely monitored and delayed tasks are not a symptom of a hosting issue
|
||||
'TASK_OVERDUE_HOURS' => 36,
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// DEPRECATED OPTIONS: CHANGE AT YOUR OWN RISK
|
||||
// These constants were once customisable but their fucntionality should now be
|
||||
// considered deprecated.
|
||||
|
||||
// AdminCP Obscurity Settings
|
||||
// It was once recommended for site owners to rename the directory for security
|
||||
// and set the CP_DIRECTORY constant so some links still work, the upgrader can put
|
||||
// files in the right place, etc. While it is still honoured, it is no longer recommended
|
||||
// as much more secure alternatives like two factor authentication now exist.
|
||||
'CP_DIRECTORY' => 'admin', // The name of the directory where the AdminCP is
|
||||
'SHOW_ACP_LINK' => TRUE, // Show a link to the AdminCP for logged-in administrators?
|
||||
|
||||
// These ones don't do anything at all, but we keep them just in case any third
|
||||
// party stuff if referencing them
|
||||
'CONNECT_MASTER_KEY' => NULL,
|
||||
'CONNECT_NOSYNC_NAMES' => FALSE,
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// DEVELOPERS/DEBUGGING: ONLY CHANGE IN LOCAL TEST SITES
|
||||
// These constants are for developers working on applications and plugins, or debugging.
|
||||
// They should never be used outside of a local test site as they will cause significant
|
||||
// speed slow downs, reveal potentially sensitive debugging information, and make
|
||||
// some features behave unexepectedly
|
||||
|
||||
// Enable Developer mode?
|
||||
// Requires Developer Tools files to be present. See
|
||||
// https://remoteservices.invisionpower.com/docs/in_dev for more information
|
||||
'IN_DEV' => FALSE,
|
||||
|
||||
// Perform coding standards checks?
|
||||
// If enabled, some aspects of the code are checked to ensure they follow IPS
|
||||
// coding standards. IPS developers use this internally but third party
|
||||
// developers may want to disable it.
|
||||
// Has no effect if IN_DEV is FALSE
|
||||
'IN_DEV_STRICT_MODE' => TRUE,
|
||||
|
||||
// Hide developer mode tools?
|
||||
// Makes Developer Mode not look like Developer Mode so that IPS developers can take
|
||||
// screenshots from Developer Mode installs without it looking unappealing.
|
||||
// Has no effect if IN_DEV is FALSE
|
||||
'DEV_HIDE_DEV_TOOLS' => FALSE,
|
||||
|
||||
// Whoops error handler settings
|
||||
// When in developer mode, Whoops overrides the normal error handler to provide more
|
||||
// debugging information. These allow you to change aspects of it.
|
||||
// Neither have any effect if IN_DEV is FALSE
|
||||
'DEV_USE_WHOOPS' => TRUE, // Use Whoops? Sometimes needs to be turned off to check how the software will behave in production.
|
||||
'DEV_WHOOPS_EDITOR' => NULL, // Allows you to define your editor so the error page can provide a link to open the file.
|
||||
'DEV_WHOOPS_HANDLER' => '\Whoops\Handler\PrettyPageHandler', // Allows you to define a custom Handler.
|
||||
|
||||
// Folder on disk to write outgoing emails to rather than sending
|
||||
// Used in developer/test installs to prevent actually sending emails or for debugging
|
||||
// purposes
|
||||
'EMAIL_DEBUG_PATH' => NULL,
|
||||
|
||||
// Path to where Java is installed
|
||||
// Needed if you want to build the core application (java will execute a .jar file)
|
||||
'JAVA_PATH' => "",
|
||||
|
||||
// Use friendly URL cache in developer mode?
|
||||
// Usually should be left off so developers can add new friendly URL definitions
|
||||
// without rebuilding, but will need to be turned off to test the friendly URL
|
||||
// configuation features.
|
||||
// Has no effect if IN_DEV is FALSE
|
||||
'DEV_USE_FURL_CACHE' => FALSE,
|
||||
|
||||
// Use the cache for the "Create" menu in developer mode? Usually should be left
|
||||
// off so developers can add things to the menu without rebuilding
|
||||
// Has no effect if IN_DEV is FALSE
|
||||
'DEV_USE_MENU_CACHE' => FALSE,
|
||||
|
||||
// Enable CSS debugging?
|
||||
// Normally CSS files get loaded all in a single request (as they would in production)
|
||||
// but this can be used to request them separately for debugging purposes.
|
||||
// Has no effect if IN_DEV is FALSE
|
||||
'DEV_DEBUG_CSS' => FALSE,
|
||||
|
||||
// Enable JavaScript debugging?
|
||||
// Dumps lots of information into the console for debugging purposes.
|
||||
'DEBUG_JS' => FALSE, // This one is used if Developer Mode is OFF (which is why it's FALSE by default)
|
||||
'DEV_DEBUG_JS' => TRUE, // This one is used if Developer Mode is ON (which is why it's TRUE by default)
|
||||
|
||||
// Enable template debugging?
|
||||
// When in developer mode, templates normally get executed with eval() but that can be
|
||||
// difficult to debug if it causes an error. With this turned on, each template will get
|
||||
// written to a PHP file and then that file will be included.
|
||||
'DEBUG_TEMPLATES' => FALSE,
|
||||
|
||||
// Enable debug logging?
|
||||
// Throughout the code we call \IPS\Log::debug() with debug infotmation, but by default
|
||||
// this doesn't do anything. Turn this on to make that information get logged.
|
||||
'DEBUG_LOG' => FALSE,
|
||||
|
||||
// Enable logging of output headers?
|
||||
// Logs every header the server is sending (if supported by the server) for
|
||||
// debugging purposes
|
||||
'DEV_LOG_HEADERS' => FALSE,
|
||||
|
||||
// Show debug messages for GraphQL API errors?
|
||||
// By default, ALL GraphQL errors will show "Internal Server Error". This option will provide more information.
|
||||
'DEBUG_GRAPHQL' => FALSE,
|
||||
|
||||
// Show database queries?
|
||||
// If enabled, a sidebar is added to every page showing all database queries that page
|
||||
// is running for debugging purposes
|
||||
'QUERY_LOG' => FALSE,
|
||||
|
||||
// Show cache read/writes?
|
||||
// If enabled, a sidebar is added to every page showing all read/writes to the cache
|
||||
// store that page is running for debugging purposes
|
||||
'CACHING_LOG' => FALSE, // Use this one for normal cache store methods
|
||||
'REDIS_LOG' => FALSE, // Use this one for Redis (which is used for more than just the normal cache store)
|
||||
|
||||
// Enable test caching method?
|
||||
// If enabled, a "Test" caching method will be enabled that just writes cache data to
|
||||
// somewhere on disk for debugging purposes
|
||||
'TEST_CACHING' => FALSE,
|
||||
|
||||
// Enable test/sandbox mode for Commerce payment gateways?
|
||||
// Sets all payment gateways into test/sandbox mode and makes a generic "Test Gateway"
|
||||
// which just acts as if a payment was successful available. Is used in development
|
||||
// so they can be tested without actually taking any money.
|
||||
'NEXUS_TEST_GATEWAYS' => FALSE,
|
||||
|
||||
// Request two-factor authentication every time
|
||||
// Normally after performing two-factor authentication you won't be asked again in the
|
||||
// same session. This overrides that for testing purposes.
|
||||
'DEV_FORCE_MFA' => FALSE,
|
||||
|
||||
// OAuth functionality requires https?
|
||||
// Used for testing only. Never disable this in a real install - it's a huge security issue.
|
||||
'OAUTH_REQUIRES_HTTPS' => TRUE,
|
||||
|
||||
// Upgrader testing
|
||||
// All of these are just used by IPS developers to test aspects of the upgrader
|
||||
'TEST_DELTA_ZIP' => '', // The path to a zip file which will be used by the upgrader rather than downloading a zip from IPS servers
|
||||
'TEST_DELTA_DETAILS' => NULL, // Array of responses to use for the various version difference tools the upgrader does rather than actually calling them
|
||||
'DELTA_FORCE_FTP' => FALSE, // Will force the upgrader to ask for FTP details, even if it would be able to just write the files
|
||||
'UPGRADE_MD5_CHECK' => TRUE, // Can be used to prevent the upgrader checking that the files that are present are correct
|
||||
'IPS_PASSWORD' => NULL, // Used to authenticate with delta system's backend
|
||||
'IPS_ALPHA_BUILD' => FALSE, // Are we submitting an alpha build to the delta system's backend?
|
||||
|
||||
// Use old UI in converter app?
|
||||
// Used for development/testing purposes
|
||||
'CONVERTERS_DEV_UI' => FALSE,
|
||||
|
||||
// Marketplace API
|
||||
// All of these are just used by IPS developers to test Marketplace integration
|
||||
'MARKETPLACE_URL' => "https://invisioncommunity.com", // The URL to the Marketplace
|
||||
'MARKETPLACE_GUEST_TOKEN' => "a6f37dc05b427d82aa5a2e5b6e6229ed_f45f8df7aa132ddfebebe33853187a5f1211d3be8cdf0b41f92c3d20664e9596", // The OAuth access token for making requests when the user is not authenticated
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// CODING SHORTCUTS: NEVER CHANGE
|
||||
// These constants only exist so that if their values need to change we only need to
|
||||
// update one single place rather than everywhere in the code. You should never need
|
||||
// to change them.
|
||||
|
||||
// Is this community running on an Invision Community in the Cloud?
|
||||
// Used to hardcode some settings, tweak certain explainations of how to do things, etc.
|
||||
'CIC' => isset( $_SERVER['IPS_CIC'] ),
|
||||
'CIC2' => ( isset( $_SERVER['IPS_CLOUD2'] ) AND isset( $_SERVER['IPS_CLOUD2_ID'] ) ),
|
||||
'SITE_FILES_PATH' => $sitePath,
|
||||
|
||||
// Root path to community
|
||||
'ROOT_PATH' => __DIR__,
|
||||
|
||||
// Random strings that change every time Invision Community is built
|
||||
// Used as a prefix in some data storage and cache engines to prevent conflicts, cache
|
||||
// busting in URLs to resources, etc.
|
||||
// Originally we just had SUITE_UNIQUE_KEY but then we found some people were, against
|
||||
// our advice, setting it static values, which broke cache busting. So we now treat
|
||||
// SUITE_UNIQUE_KEY as "might change with every release but might not" and added
|
||||
// CACHEBUST_KEY to be a "for reals, will change every release" one. DO NOT set a value
|
||||
// for it in constants.php
|
||||
'SUITE_UNIQUE_KEY' => $uniqueKey,
|
||||
'CACHEBUST_KEY' => mb_substr( md5( '13_mafia' . '$Rev: 3023$'), 10, 10 ),
|
||||
|
||||
// Thumbnail size
|
||||
// This needs to be hardcoded rather than configurable because it's the smallest size that
|
||||
// will still work based on how we actually use these images.
|
||||
'PHOTO_THUMBNAIL_SIZE' => 240, // For profile photos. The max we display is 120x120, so this allows for double size for high dpi screens
|
||||
'THUMBNAIL_SIZE' => '500x500', // For other random things like Downloads screenshots and Pages record images. Is just a generic reasonable size.
|
||||
|
||||
// Default theme ID
|
||||
// It isn't really possible to change this but we have it defined as a constant rather
|
||||
// than putting "1" everywhere in the code just in case. If you deleted theme ID 1 and attempt to
|
||||
// build a custom application as a developer, you may need to override this value to specify a new
|
||||
// default/unmodified theme.
|
||||
'DEFAULT_THEME_ID' => 1,
|
||||
|
||||
// Mobile App Stuff
|
||||
// Do not change these for white-label purposes. White-label apps will be accounted for through settings
|
||||
// @todo These are the *beta* app IDs. Need to updae when apps go final.
|
||||
'APP_MULTICOMMUNITY_ITUNES_ID' => '1520255870',
|
||||
'APP_MULTICOMMUNITY_ITUNES_URL' => 'https://testflight.apple.com/join/bzsWOXFO',
|
||||
'APP_MULTICOMMUNITY_PLAY_ID' => 'com.invisioncommunity.communities',
|
||||
'APP_MULTICOMMUNITY_PLAY_URL' => 'https://play.google.com/apps/testing/com.invisioncommunity.communities',
|
||||
'APP_MULTICOMMUNITY_SCHEMA' => 'invision-communities',
|
||||
'DEBUG_OAUTH_REDIRECTS' => [],
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// SPECIAL MODES: NEVER CHANGE
|
||||
// These constants are set in certain areas so the framework knows it needs to behave
|
||||
// differently. They should NEVER be changed globally - very bad things will happen if you do.
|
||||
|
||||
// Toggle for if uncaught exceptions should (if enabled) be reported back to IPS
|
||||
// We set it false here and then enable it at the top of our own scripts so that
|
||||
// any third-party code which is using the IPS framework *doesn't* have it enabled
|
||||
// which causes stuff we don't want to get reported to us.
|
||||
// Note this has nothing to do with displaying errors. DO NOT CHANGE IT.
|
||||
'REPORT_EXCEPTIONS' => FALSE,
|
||||
|
||||
// Toggle for MySQL read/write separation
|
||||
// The whole of MySQL read/write separation functionality is experimental - we set
|
||||
// this in the AdminCP/upgrader/etc. because we haven't made those areas read/write
|
||||
// separation ready.
|
||||
'READ_WRITE_SEPARATION' => TRUE,
|
||||
|
||||
// Demo Mode
|
||||
// We set this on demo installs. Disables some functionality.
|
||||
'DEMO_MODE' => FALSE,
|
||||
|
||||
// Unit Testing Mode
|
||||
// We set this for unit testing scripts to bypass certain global checks.
|
||||
'ENFORCE_ACCESS' => FALSE,
|
||||
);
|
||||
// ==========================================================================================
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,26 +534,45 @@ class IPS
|
||||
mb_internal_encoding('UTF-8');
|
||||
|
||||
/* Define the IN_IPB constant - this needs to be in the global namespace for backwards compatibility */
|
||||
define( 'IN_IPB', TRUE );
|
||||
\define( 'IN_IPB', TRUE );
|
||||
|
||||
/* Load constants.php */
|
||||
if( file_exists( __DIR__ . '/constants.php' ) )
|
||||
if ( isset( $_SERVER['IPS_CLOUD2'] ) AND isset( $_SERVER['IPS_CLOUD2_ID'] ) )
|
||||
{
|
||||
@include_once( __DIR__ . '/constants.php' );
|
||||
if ( file_exists( "/var/www/sitefiles/{$_SERVER['IPS_CLOUD2_ID']}/constants.php" ) )
|
||||
{
|
||||
@include_once( "/var/www/sitefiles/{$_SERVER['IPS_CLOUD2_ID']}/constants.php" );
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if( file_exists( __DIR__ . '/constants.php' ) )
|
||||
{
|
||||
@include_once( __DIR__ . '/constants.php' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Load in our CiC functions */
|
||||
if( file_exists( __DIR__ . '/system/Cicloud/Cicloud.php' ) )
|
||||
{
|
||||
@require_once( __DIR__ . '/system/Cicloud/Cicloud.php' );
|
||||
}
|
||||
|
||||
/* Do we have a CiC config */
|
||||
self::unpackCicConfig();
|
||||
|
||||
/* Import and set defaults */
|
||||
$defaultConstants = static::defaultConstants();
|
||||
|
||||
foreach ( $defaultConstants as $k => $v )
|
||||
{
|
||||
if( defined( $k ) )
|
||||
if( \defined( $k ) )
|
||||
{
|
||||
define( 'IPS\\' . $k, constant( $k ) );
|
||||
\define( 'IPS\\' . $k, \constant( $k ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
define( 'IPS\\' . $k, $v );
|
||||
\define( 'IPS\\' . $k, $v );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +583,7 @@ class IPS
|
||||
}
|
||||
|
||||
/* Load developer code */
|
||||
if( IN_DEV and file_exists( ROOT_PATH . '/dev/function_overrides.php' ) )
|
||||
if( IN_DEV and IN_DEV_STRICT_MODE and file_exists( ROOT_PATH . '/dev/function_overrides.php' ) )
|
||||
{
|
||||
self::$inDevCode = file_get_contents( ROOT_PATH . '/dev/function_overrides.php' );
|
||||
}
|
||||
@@ -185,7 +596,9 @@ class IPS
|
||||
{
|
||||
self::$PSR0Namespaces['Whoops'] = ROOT_PATH . '/dev/Whoops';
|
||||
$whoops = new \Whoops\Run;
|
||||
$handler = new \Whoops\Handler\PrettyPageHandler;
|
||||
$handlerClass = \IPS\DEV_WHOOPS_HANDLER;
|
||||
$handler = new $handlerClass;
|
||||
|
||||
if ( \IPS\DEV_WHOOPS_EDITOR )
|
||||
{
|
||||
$handler->setEditor( \IPS\DEV_WHOOPS_EDITOR );
|
||||
@@ -200,9 +613,9 @@ class IPS
|
||||
}
|
||||
|
||||
/* Init hooks */
|
||||
if ( file_exists( \IPS\ROOT_PATH . '/plugins/hooks.php' ) )
|
||||
{
|
||||
if ( !( self::$hooks = require( \IPS\ROOT_PATH . '/plugins/hooks.php' ) ) )
|
||||
if ( file_exists( \IPS\SITE_FILES_PATH . "/plugins/hooks.php" ) )
|
||||
{
|
||||
if ( !( self::$hooks = require( \IPS\SITE_FILES_PATH . '/plugins/hooks.php' ) ) )
|
||||
{
|
||||
self::$hooks = array();
|
||||
}
|
||||
@@ -241,7 +654,7 @@ class IPS
|
||||
if( !class_exists( "{$namespace}\\_{$class}", FALSE ) )
|
||||
{
|
||||
/* Locate file */
|
||||
$path = ROOT_PATH . '/';
|
||||
$path = '';
|
||||
$sourcesDirSet = FALSE;
|
||||
foreach ( array_merge( $bits, array( $class ) ) as $i => $bit )
|
||||
{
|
||||
@@ -249,7 +662,14 @@ class IPS
|
||||
{
|
||||
if( $i === 0 )
|
||||
{
|
||||
$path .= 'applications/';
|
||||
if ( \IPS\CIC2 AND !\in_array( $bit, static::$ipsApps ) )
|
||||
{
|
||||
$path .= SITE_FILES_PATH . '/applications/'; // Applications are in the root on Cloud2
|
||||
}
|
||||
else
|
||||
{
|
||||
$path .= ROOT_PATH . '/applications/';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -264,7 +684,7 @@ class IPS
|
||||
{
|
||||
if( $i === 0 )
|
||||
{
|
||||
$path .= 'system/';
|
||||
$path .= ROOT_PATH . '/system/';
|
||||
}
|
||||
elseif ( $i === 1 and $bit === 'Application' )
|
||||
{
|
||||
@@ -289,7 +709,7 @@ class IPS
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
require_once( $path );
|
||||
|
||||
/* Is it an interface? */
|
||||
@@ -298,8 +718,8 @@ class IPS
|
||||
return;
|
||||
}
|
||||
|
||||
/* Is it a trait? The function_exists call is just so PHP 5.3 doesn't throw a fatal error (even though it's required, we want it to fail gracefully) */
|
||||
if ( function_exists('trait_exists') and trait_exists( "{$namespace}\\{$class}", FALSE ) )
|
||||
/* Is it a trait? */
|
||||
if ( trait_exists( "{$namespace}\\{$class}", FALSE ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -311,12 +731,12 @@ class IPS
|
||||
}
|
||||
|
||||
/* Stuff for developer mode */
|
||||
if( IN_DEV )
|
||||
if( IN_DEV and IN_DEV_STRICT_MODE )
|
||||
{
|
||||
$reflection = new \ReflectionClass( "{$namespace}\\_{$class}" );
|
||||
|
||||
/* Import our code to override forbidden functions */
|
||||
if( !in_array( \strtolower( $namespace ), self::$inDevCodeImportedTo ) )
|
||||
if( !\in_array( \strtolower( $namespace ), self::$inDevCodeImportedTo ) )
|
||||
{
|
||||
$inDevCode = self::$inDevCode;
|
||||
self::$inDevCodeImportedTo[] = \strtolower( $namespace );
|
||||
@@ -379,7 +799,7 @@ class IPS
|
||||
and
|
||||
!preg_match( '/^(GET|POST|PUT|DELETE)[a-zA-Z_]+$/', $method->name ) // API methods have a specific naming format
|
||||
and
|
||||
!in_array( $method->name, array( // PHP's magic methods are allowed (except __sleep and __wakeup as we don't allow serializing)
|
||||
!\in_array( $method->name, array( // PHP's magic methods are allowed (except __sleep and __wakeup as we don't allow serializing)
|
||||
'__construct',
|
||||
'__destruct',
|
||||
'__call',
|
||||
@@ -425,7 +845,7 @@ class IPS
|
||||
}
|
||||
|
||||
/* Check we have at least one non-static method (unless this class is abstract or has a parent) */
|
||||
elseif( !$reflection->isAbstract() and $reflection->getParentClass() === FALSE and !$hasNonStatic and $reflection->getNamespacename() !== 'IPS\Output\Plugin' and !in_array( 'extensions', $bits ) and !in_array( 'templateplugins', $bits ) )
|
||||
elseif( !$reflection->isAbstract() and $reflection->getParentClass() === FALSE and !$hasNonStatic and $reflection->getNamespacename() !== 'IPS\Output\Plugin' and !\in_array( 'extensions', $bits ) and !\in_array( 'templateplugins', $bits ) )
|
||||
{
|
||||
trigger_error( "You do not have any methods in {$classname} which are not static. Please refactor. (PHP Coding Standards: Functions and Methods.6)", E_USER_ERROR );
|
||||
}
|
||||
@@ -452,9 +872,15 @@ class IPS
|
||||
{
|
||||
foreach ( self::$hooks[ "\\{$namespace}\\{$finalClass}" ] as $id => $data )
|
||||
{
|
||||
if ( file_exists( ROOT_PATH . '/' . $data['file'] ) )
|
||||
|
||||
$path = ROOT_PATH;
|
||||
if ( \IPS\CIC2 AND static::isThirdParty( $data['file'] ) )
|
||||
{
|
||||
$contents = "namespace {$namespace}; ". str_replace( '_HOOK_CLASS_', $realClass, file_get_contents( ROOT_PATH . '/' . $data['file'] ) );
|
||||
$path = SITE_FILES_PATH;
|
||||
}
|
||||
if ( file_exists( $path . '/' . $data['file'] ) )
|
||||
{
|
||||
$contents = "namespace {$namespace}; ". str_replace( '_HOOK_CLASS_', $realClass, file_get_contents( $path . '/' . $data['file'] ) );
|
||||
try
|
||||
{
|
||||
if( @eval( $contents ) !== FALSE )
|
||||
@@ -480,6 +906,35 @@ class IPS
|
||||
trigger_error( "There was an error initiating the class {$namespace}\\{$finalClass}.", E_USER_ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a file is a part of a third party application or plugin
|
||||
*
|
||||
* @param string $path The file path.
|
||||
* @return bool
|
||||
*/
|
||||
protected static function isThirdParty( string $path ): bool
|
||||
{
|
||||
$bits = explode( '/', $path );
|
||||
|
||||
/* Plugins are always third party */
|
||||
if ( $bits[0] === 'plugins' )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( $bits[0] === 'applications' AND isset( $bits[1] ) AND \in_array( $bits[1], static::$ipsApps ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Last error
|
||||
*/
|
||||
public static $lastError;
|
||||
|
||||
/**
|
||||
* Error Handler
|
||||
@@ -493,8 +948,10 @@ class IPS
|
||||
*/
|
||||
public static function errorHandler( $errno, $errstr, $errfile, $errline, $trace=NULL )
|
||||
{
|
||||
self::$lastError = new \ErrorException( $errstr, $errno, 0, $errfile, $errline );
|
||||
|
||||
/* We don't care about these in production */
|
||||
if ( in_array( $errno, array( E_WARNING, E_NOTICE, E_STRICT, E_DEPRECATED ) ) )
|
||||
if ( \in_array( $errno, array( E_WARNING, E_NOTICE, E_STRICT, E_DEPRECATED ) ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -505,7 +962,7 @@ class IPS
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new \ErrorException( $errstr, $errno, 0, $errfile, $errline );
|
||||
throw self::$lastError;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -523,13 +980,7 @@ class IPS
|
||||
$showMessage = TRUE;
|
||||
}
|
||||
|
||||
/* Work out what we'll log - exception classes can provide extra data */
|
||||
$log = '';
|
||||
if ( method_exists( $exception, 'extraLogData' ) )
|
||||
{
|
||||
$log .= $exception->extraLogData() . "\n";
|
||||
}
|
||||
$log .= get_class( $exception ) . ": " . $exception->getMessage() . " (" . $exception->getCode() . ")\n" . $exception->getTraceAsString();
|
||||
$log = static::getExceptionDetails( $exception );
|
||||
|
||||
/* Log it (unless it's a MySQL server error) */
|
||||
if( ! ( $exception instanceof \IPS\Db\Exception and $exception->isServerError() ) )
|
||||
@@ -589,6 +1040,25 @@ class IPS
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get exception details as a string, suitable to display in an error (to admins only)
|
||||
*
|
||||
* @param \Exception $exception Exception
|
||||
* @return string
|
||||
*/
|
||||
public static function getExceptionDetails( $exception )
|
||||
{
|
||||
/* Work out what we'll log - exception classes can provide extra data */
|
||||
$log = '';
|
||||
if ( method_exists( $exception, 'extraLogData' ) )
|
||||
{
|
||||
$log .= $exception->extraLogData() . "\n";
|
||||
}
|
||||
$log .= \get_class( $exception ) . ": " . $exception->getMessage() . " (" . $exception->getCode() . ")\n" . $exception->getTraceAsString();
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a given exception be reported to IPS? Filter out 3rd party etc.
|
||||
@@ -600,7 +1070,7 @@ class IPS
|
||||
{
|
||||
$response = \IPS\Http\Url::external('https://invisionpowerdiagnostics.com')->request()->post( array(
|
||||
'version' => \IPS\Application::getAvailableVersion('core'),
|
||||
'class' => get_class( $exception ),
|
||||
'class' => \get_class( $exception ),
|
||||
'message' => $exception->getMessage(),
|
||||
'code' => $exception->getCode(),
|
||||
'file' => str_replace( \IPS\ROOT_PATH, '', $exception->getFile() ),
|
||||
@@ -617,7 +1087,7 @@ class IPS
|
||||
/**
|
||||
* Generic exception page
|
||||
*
|
||||
* @param \Exception $exception Exception class
|
||||
* @param string $message The error message
|
||||
* @return void
|
||||
* @note Abstracted so Theme can call this if templates are in the process of building
|
||||
*/
|
||||
@@ -631,7 +1101,12 @@ class IPS
|
||||
{
|
||||
header( "HTTP/1.1 500 Internal Server Error" );
|
||||
}
|
||||
|
||||
|
||||
/* Don't allow error pages to be cached */
|
||||
header( "Cache-Control: no-cache, no-store, must-revalidate" );
|
||||
header( "Pragma: no-cache" );
|
||||
header( "Expires: 0" );
|
||||
|
||||
require \IPS\ROOT_PATH . '/' . \IPS\ERROR_PAGE;
|
||||
exit;
|
||||
}
|
||||
@@ -648,7 +1123,7 @@ class IPS
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( in_array( $trait, class_uses( $class ) ) )
|
||||
if ( \in_array( $trait, class_uses( $class ) ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -721,14 +1196,13 @@ class IPS
|
||||
);
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check license key
|
||||
*
|
||||
* @param string The license key
|
||||
* @param string The site URL
|
||||
* @param string $val The license key
|
||||
* @param string $url The site URL
|
||||
* @return void
|
||||
* @throws \DomainException
|
||||
*/
|
||||
@@ -761,7 +1235,7 @@ class IPS
|
||||
{
|
||||
foreach ( $matches[1] as $appKey )
|
||||
{
|
||||
if ( !in_array( $appKey, \IPS\Application::$ipsApps ) )
|
||||
if ( !\in_array( $appKey, \IPS\Application::$ipsApps ) )
|
||||
{
|
||||
return $appKey;
|
||||
}
|
||||
@@ -777,7 +1251,7 @@ class IPS
|
||||
{
|
||||
if ( preg_match( '/' . preg_quote( DIRECTORY_SEPARATOR, '/' ) . 'applications' . preg_quote( DIRECTORY_SEPARATOR, '/' ) . '([a-zA-Z]+)/', str_replace( \IPS\ROOT_PATH, '', $line ), $matches ) )
|
||||
{
|
||||
if ( !in_array( $matches[1], \IPS\Application::$ipsApps ) )
|
||||
if ( !\in_array( $matches[1], \IPS\Application::$ipsApps ) )
|
||||
{
|
||||
return $matches[1];
|
||||
}
|
||||
@@ -793,6 +1267,9 @@ class IPS
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* !CiC Wrapper Methods */
|
||||
/* The \IPS\Cicloud class only exists on Community in the Cloud, so these methods allow us to call those methods without erroring if the class doesn't exist */
|
||||
|
||||
/**
|
||||
* Resync IPS Cloud File System
|
||||
* Must be called when writing any files to disk on IPS Community in the Cloud
|
||||
@@ -802,21 +1279,69 @@ class IPS
|
||||
*/
|
||||
public static function resyncIPSCloud( $reason = NULL )
|
||||
{
|
||||
if ( \IPS\CIC )
|
||||
if ( \IPS\CIC AND \function_exists( 'IPS\Cicloud\resyncIPSCloud' ) )
|
||||
{
|
||||
if ( preg_match( '/^\/var\/www\/html\/(.+?)(?:\/|$)/i', \IPS\ROOT_PATH, $matches ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Http\Url::external('http://ips-cic-fileupdate.invisioncic.com/')
|
||||
->setQueryString( array( 'user' => $matches[1], 'reason' => $reason ) )
|
||||
->request()
|
||||
->post();
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
\IPS\Cicloud\resyncIPSCloud( $reason );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send IPS Cloud applylatestfiles command
|
||||
* Fallback for autoupgrade failures
|
||||
*
|
||||
* @param int $version If we're upgrading, the current version we are running.
|
||||
* @return void
|
||||
*/
|
||||
public static function applyLatestFilesIPSCloud( ?int $version = NULL )
|
||||
{
|
||||
if ( \IPS\CIC AND \function_exists( 'IPS\Cicloud\applyLatestFilesIPSCloud' ) )
|
||||
{
|
||||
\IPS\Cicloud\applyLatestFilesIPSCloud( $version );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get CiCloud User
|
||||
*
|
||||
* @return string|NULL
|
||||
*/
|
||||
public static function getCicUsername(): ?string
|
||||
{
|
||||
if ( \IPS\CIC AND \function_exists( 'IPS\Cicloud\getCicUsername' ) )
|
||||
{
|
||||
return \IPS\Cicloud\getCicUsername();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the special IPS_CLOUD_CONFIG environment variable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function unpackCicConfig()
|
||||
{
|
||||
/* This method is slightly different because it needs to run before anything else to establish our Cicloud configuration */
|
||||
if ( \function_exists( 'IPS\Cicloud\unpackCicConfig' ) )
|
||||
{
|
||||
\IPS\Cicloud\unpackCicConfig();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile Redis Config
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function compileCicRedisConfig()
|
||||
{
|
||||
if ( \function_exists( 'IPS\Cicloud\compileRedisConfig' ) )
|
||||
{
|
||||
return \IPS\Cicloud\compileRedisConfig();
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/* Init */
|
||||
@@ -826,7 +1351,7 @@ IPS::init();
|
||||
eval( '
|
||||
function mb_ucfirst()
|
||||
{
|
||||
$text = func_get_arg( 0 );
|
||||
$text = \func_get_arg( 0 );
|
||||
return mb_strtoupper( mb_substr( $text, 0, 1 ) ) . mb_substr( $text, 1 );
|
||||
}
|
||||
');
|
||||
Reference in new issue
Block a user