Commit a741dd8c by Scott

Remove error suppression on constants

parent 23b1aa33
...@@ -24,8 +24,16 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -24,8 +24,16 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
exit; exit;
} }
@define('QA_MIN_PASSWORD_LEN', 4); if (!defined('QA_MIN_PASSWORD_LEN')) {
@define('QA_NEW_PASSWORD_LEN', 8); // when resetting password define('QA_MIN_PASSWORD_LEN', 4);
}
if (!defined('QA_NEW_PASSWORD_LEN')){
/**
* @deprecated This was the length of the reset password generated by Q2A. No longer used.
*/
define('QA_NEW_PASSWORD_LEN', 8);
}
/** /**
......
...@@ -47,8 +47,13 @@ define('QA_FIELD_FLAGS_MULTI_LINE', 1); ...@@ -47,8 +47,13 @@ define('QA_FIELD_FLAGS_MULTI_LINE', 1);
define('QA_FIELD_FLAGS_LINK_URL', 2); define('QA_FIELD_FLAGS_LINK_URL', 2);
define('QA_FIELD_FLAGS_ON_REGISTER', 4); define('QA_FIELD_FLAGS_ON_REGISTER', 4);
@define('QA_FORM_EXPIRY_SECS', 86400); // how many seconds a form is valid for submission if (!defined('QA_FORM_EXPIRY_SECS')) {
@define('QA_FORM_KEY_LENGTH', 32); // how many seconds a form is valid for submission
define('QA_FORM_EXPIRY_SECS', 86400);
}
if (!defined('QA_FORM_KEY_LENGTH')) {
define('QA_FORM_KEY_LENGTH', 32);
}
if (QA_FINAL_EXTERNAL_USERS) { if (QA_FINAL_EXTERNAL_USERS) {
......
...@@ -25,43 +25,46 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly ...@@ -25,43 +25,46 @@ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly
} }
// Maximum column sizes - any of these can be defined in qa-config.php to override the defaults below, $maximaDefaults = array(
// but you need to do so before creating the database, otherwise it's too late. // Maximum column sizes - any of these can be defined in qa-config.php to override the defaults below,
// but you need to do so before creating the database, otherwise it's too late.
'QA_DB_MAX_EMAIL_LENGTH' => 80,
'QA_DB_MAX_HANDLE_LENGTH' => 20,
'QA_DB_MAX_TITLE_LENGTH' => 800,
'QA_DB_MAX_CONTENT_LENGTH' => 12000,
'QA_DB_MAX_FORMAT_LENGTH' => 20,
'QA_DB_MAX_TAGS_LENGTH' => 800,
'QA_DB_MAX_NAME_LENGTH' => 40,
'QA_DB_MAX_WORD_LENGTH' => 80,
'QA_DB_MAX_CAT_PAGE_TITLE_LENGTH' => 80,
'QA_DB_MAX_CAT_PAGE_TAGS_LENGTH' => 200,
'QA_DB_MAX_CAT_CONTENT_LENGTH' => 800,
'QA_DB_MAX_WIDGET_TAGS_LENGTH' => 800,
'QA_DB_MAX_WIDGET_TITLE_LENGTH' => 80,
'QA_DB_MAX_OPTION_TITLE_LENGTH' => 40,
'QA_DB_MAX_PROFILE_TITLE_LENGTH' => 40,
'QA_DB_MAX_PROFILE_CONTENT_LENGTH' => 8000,
'QA_DB_MAX_CACHE_AGE' => 86400,
'QA_DB_MAX_BLOB_FILE_NAME_LENGTH' => 255,
'QA_DB_MAX_META_TITLE_LENGTH' => 40,
'QA_DB_MAX_META_CONTENT_LENGTH' => 8000,
@define('QA_DB_MAX_EMAIL_LENGTH', 80); // How many records to retrieve for different circumstances. In many cases we retrieve more records than we
@define('QA_DB_MAX_HANDLE_LENGTH', 20); // end up needing to display once we know the value of an option. Wasteful, but allows one query per page.
@define('QA_DB_MAX_TITLE_LENGTH', 800); 'QA_DB_RETRIEVE_QS_AS' => 50,
@define('QA_DB_MAX_CONTENT_LENGTH', 12000); 'QA_DB_RETRIEVE_TAGS' => 200,
@define('QA_DB_MAX_FORMAT_LENGTH', 20); 'QA_DB_RETRIEVE_USERS' => 200,
@define('QA_DB_MAX_TAGS_LENGTH', 800); 'QA_DB_RETRIEVE_ASK_TAG_QS' => 500,
@define('QA_DB_MAX_NAME_LENGTH', 40); 'QA_DB_RETRIEVE_COMPLETE_TAGS' => 1000,
@define('QA_DB_MAX_WORD_LENGTH', 80); 'QA_DB_RETRIEVE_MESSAGES' => 20,
@define('QA_DB_MAX_CAT_PAGE_TITLE_LENGTH', 80);
@define('QA_DB_MAX_CAT_PAGE_TAGS_LENGTH', 200);
@define('QA_DB_MAX_CAT_CONTENT_LENGTH', 800);
@define('QA_DB_MAX_WIDGET_TAGS_LENGTH', 800);
@define('QA_DB_MAX_WIDGET_TITLE_LENGTH', 80);
@define('QA_DB_MAX_OPTION_TITLE_LENGTH', 40);
@define('QA_DB_MAX_PROFILE_TITLE_LENGTH', 40);
@define('QA_DB_MAX_PROFILE_CONTENT_LENGTH', 8000);
@define('QA_DB_MAX_CACHE_AGE', 86400);
@define('QA_DB_MAX_BLOB_FILE_NAME_LENGTH', 255);
@define('QA_DB_MAX_META_TITLE_LENGTH', 40);
@define('QA_DB_MAX_META_CONTENT_LENGTH', 8000);
// Keep event streams trimmed - not worth storing too many events per question because we only display the
// most recent event for each question, that has not been invalidated due to hiding/unselection/etc...
'QA_DB_MAX_EVENTS_PER_Q' => 5,
);
// How many records to retrieve for different circumstances. In many cases we retrieve more records than we foreach ($maximaDefaults as $key=>$def) {
// end up needing to display once we know the value of an option. Wasteful, but allows one query per page. if (!defined($key)) {
define($key, $def);
@define('QA_DB_RETRIEVE_QS_AS', 50); }
@define('QA_DB_RETRIEVE_TAGS', 200); }
@define('QA_DB_RETRIEVE_USERS', 200);
@define('QA_DB_RETRIEVE_ASK_TAG_QS', 500);
@define('QA_DB_RETRIEVE_COMPLETE_TAGS', 1000);
@define('QA_DB_RETRIEVE_MESSAGES', 20);
// Keep event streams trimmed - not worth storing too many events per question because we only display the
// most recent event for each question, that has not been invalidated due to hiding/unselection/etc...
@define('QA_DB_MAX_EVENTS_PER_Q', 5);
...@@ -241,15 +241,23 @@ function qa_initialize_constants_2() ...@@ -241,15 +241,23 @@ function qa_initialize_constants_2()
{ {
// Default values if not set in qa-config.php // Default values if not set in qa-config.php
@define('QA_COOKIE_DOMAIN', ''); $defaults = array(
@define('QA_HTML_COMPRESSION', true); 'QA_COOKIE_DOMAIN' => '',
@define('QA_MAX_LIMIT_START', 19999); 'QA_HTML_COMPRESSION' => true,
@define('QA_IGNORED_WORDS_FREQ', 10000); 'QA_MAX_LIMIT_START' => 19999,
@define('QA_ALLOW_UNINDEXED_QUERIES', false); 'QA_IGNORED_WORDS_FREQ' => 10000,
@define('QA_OPTIMIZE_LOCAL_DB', true); // no longer used 'QA_ALLOW_UNINDEXED_QUERIES' => false,
@define('QA_OPTIMIZE_DISTANT_DB', false); 'QA_OPTIMIZE_LOCAL_DB' => true,
@define('QA_PERSISTENT_CONN_DB', false); 'QA_OPTIMIZE_DISTANT_DB' => false,
@define('QA_DEBUG_PERFORMANCE', false); 'QA_PERSISTENT_CONN_DB' => false,
'QA_DEBUG_PERFORMANCE' => false,
);
foreach ($defaults as $key=>$def) {
if (!defined($key)) {
define($key, $def);
}
}
// Start performance monitoring // Start performance monitoring
......
...@@ -812,12 +812,18 @@ function qa_string_matches_one($string, $matches) ...@@ -812,12 +812,18 @@ function qa_string_matches_one($string, $matches)
// Some static definitions and initialization // Some static definitions and initialization
// Notable exclusions here: $ & - _ # % @ // Notable exclusions here: $ & - _ # % @
@define('QA_PREG_INDEX_WORD_SEPARATOR', '[\n\r\t\ \!\"\\\'\(\)\*\+\,\.\/\:\;\<\=\>\?\[\\\\\]\^\`\{\|\}\~]'); if (!defined('QA_PREG_INDEX_WORD_SEPARATOR')) {
define('QA_PREG_INDEX_WORD_SEPARATOR', '[\n\r\t\ \!\"\\\'\(\)\*\+\,\.\/\:\;\<\=\>\?\[\\\\\]\^\`\{\|\}\~]');
}
// Asterisk (*) excluded here because it's used to match anything // Asterisk (*) excluded here because it's used to match anything
@define('QA_PREG_BLOCK_WORD_SEPARATOR', '[\n\r\t\ \!\"\\\'\(\)\+\,\.\/\:\;\<\=\>\?\[\\\\\]\^\`\{\|\}\~\$\&\-\_\#\%\@]'); if (!defined('QA_PREG_BLOCK_WORD_SEPARATOR')) {
define('QA_PREG_BLOCK_WORD_SEPARATOR', '[\n\r\t\ \!\"\\\'\(\)\+\,\.\/\:\;\<\=\>\?\[\\\\\]\^\`\{\|\}\~\$\&\-\_\#\%\@]');
}
// Pattern to match Chinese/Japanese/Korean ideographic symbols in UTF-8 encoding // Pattern to match Chinese/Japanese/Korean ideographic symbols in UTF-8 encoding
@define('QA_PREG_CJK_IDEOGRAPHS_UTF8', '\xE2[\xBA-\xBF][\x80-\xBF]|\xE3[\x80\x88-\xBF][\x80-\xBF]|[\xE4-\xE9][\x80-\xBF][\x80-\xBF]|\xEF[\xA4-\xAB][\x80-\xBF]|\xF0[\xA0-\xAF][\x80-\xBF][\x80-\xBF]'); if (!defined('QA_PREG_CJK_IDEOGRAPHS_UTF8')) {
define('QA_PREG_CJK_IDEOGRAPHS_UTF8', '\xE2[\xBA-\xBF][\x80-\xBF]|\xE3[\x80\x88-\xBF][\x80-\xBF]|[\xE4-\xE9][\x80-\xBF][\x80-\xBF]|\xEF[\xA4-\xAB][\x80-\xBF]|\xF0[\xA0-\xAF][\x80-\xBF][\x80-\xBF]');
}
qa_string_initialize(); qa_string_initialize();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment