Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
5ebb1854
Commit
5ebb1854
authored
Mar 15, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to prevent certain usernames
Defaults to ‘anonymous’
parent
e2529b61
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
1 deletions
+15
-1
options.php
qa-include/app/options.php
+4
-0
qa-lang-options.php
qa-include/lang/qa-lang-options.php
+1
-0
qa-lang-users.php
qa-include/lang/qa-lang-users.php
+1
-0
admin-default.php
qa-include/pages/admin/admin-default.php
+3
-1
qa-filter-basic.php
qa-include/plugins/qa-filter-basic.php
+6
-0
No files found.
qa-include/app/options.php
View file @
5ebb1854
...
@@ -436,6 +436,10 @@ function qa_default_option($name)
...
@@ -436,6 +436,10 @@ function qa_default_option($name)
$value
=
qa_lang_html_sub
(
'options/default_terms'
,
qa_html
(
qa_opt
(
'site_title'
)));
$value
=
qa_lang_html_sub
(
'options/default_terms'
,
qa_html
(
qa_opt
(
'site_title'
)));
break
;
break
;
case
'block_bad_usernames'
:
$value
=
qa_lang_html
(
'main/anonymous'
);
break
;
case
'custom_sidebar'
:
case
'custom_sidebar'
:
$value
=
qa_lang_html_sub
(
'options/default_sidebar'
,
qa_html
(
qa_opt
(
'site_title'
)));
$value
=
qa_lang_html_sub
(
'options/default_sidebar'
,
qa_html
(
qa_opt
(
'site_title'
)));
break
;
break
;
...
...
qa-include/lang/qa-lang-options.php
View file @
5ebb1854
...
@@ -45,6 +45,7 @@ return array(
...
@@ -45,6 +45,7 @@ return array(
'avatar_q_page_q_size'
=>
'Avatar size on questions:'
,
'avatar_q_page_q_size'
=>
'Avatar size on questions:'
,
'avatar_store_size'
=>
'Maximum size for storing avatars:'
,
'avatar_store_size'
=>
'Maximum size for storing avatars:'
,
'avatar_users_size'
=>
'Avatar size on top users page:'
,
'avatar_users_size'
=>
'Avatar size on top users page:'
,
'block_bad_usernames'
=>
'Disallowed usernames - separate by spaces or commas:'
,
'block_bad_words'
=>
'Censored words - separate by spaces or commas:'
,
'block_bad_words'
=>
'Censored words - separate by spaces or commas:'
,
'block_ips_write'
=>
'Blocked IP addresses - separate by spaces or commas:'
,
'block_ips_write'
=>
'Blocked IP addresses - separate by spaces or commas:'
,
'caching_catwidget_time'
=>
'Cache category widget for:'
,
'caching_catwidget_time'
=>
'Cache category widget for:'
,
...
...
qa-include/lang/qa-lang-users.php
View file @
5ebb1854
...
@@ -63,6 +63,7 @@ return array(
...
@@ -63,6 +63,7 @@ return array(
'email_required'
=>
'Email address required - not public'
,
'email_required'
=>
'Email address required - not public'
,
'forgot_link'
=>
'I forgot my password'
,
'forgot_link'
=>
'I forgot my password'
,
'full_name'
=>
'Full name'
,
'full_name'
=>
'Full name'
,
'handle_blocked'
=>
'Username is disallowed - please try another'
,
'handle_empty'
=>
'Username must not be empty'
,
'handle_empty'
=>
'Username must not be empty'
,
'handle_exists'
=>
'Username is taken - please try another'
,
'handle_exists'
=>
'Username is taken - please try another'
,
'handle_has_bad'
=>
'Username may not contain: ^'
,
'handle_has_bad'
=>
'Username may not contain: ^'
,
...
...
qa-include/pages/admin/admin-default.php
View file @
5ebb1854
...
@@ -322,7 +322,7 @@ switch ($adminsection) {
...
@@ -322,7 +322,7 @@ switch ($adminsection) {
require_once
QA_INCLUDE_DIR
.
'util/image.php'
;
require_once
QA_INCLUDE_DIR
.
'util/image.php'
;
array_push
(
$showoptions
,
'show_custom_register'
,
'custom_register'
,
'show_register_terms'
,
'register_terms'
,
'show_notice_welcome'
,
'notice_welcome'
,
'show_custom_welcome'
,
'custom_welcome'
,
array_push
(
$showoptions
,
'show_custom_register'
,
'custom_register'
,
'show_register_terms'
,
'register_terms'
,
'show_notice_welcome'
,
'notice_welcome'
,
'show_custom_welcome'
,
'custom_welcome'
,
''
,
'allow_login_email_only'
,
'allow_change_usernames'
,
'register_notify_admin'
,
'suspend_register_users'
,
''
,
'allow_login_email_only'
,
'allow_change_usernames'
,
'register_notify_admin'
,
'suspend_register_users'
,
''
,
'block_bad_usernames'
,
''
,
'allow_private_messages'
,
'show_message_history'
,
'page_size_pms'
,
'allow_user_walls'
,
'page_size_wall'
,
''
,
'allow_private_messages'
,
'show_message_history'
,
'page_size_pms'
,
'allow_user_walls'
,
'page_size_wall'
,
''
,
'avatar_allow_gravatar'
);
''
,
'avatar_allow_gravatar'
);
...
@@ -747,6 +747,7 @@ else {
...
@@ -747,6 +747,7 @@ else {
break
;
break
;
case
'block_bad_words'
:
case
'block_bad_words'
:
case
'block_bad_usernames'
:
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
$optionvalue
=
implode
(
' , '
,
qa_block_words_explode
(
$optionvalue
));
$optionvalue
=
implode
(
' , '
,
qa_block_words_explode
(
$optionvalue
));
break
;
break
;
...
@@ -1243,6 +1244,7 @@ foreach ($showoptions as $optionname) {
...
@@ -1243,6 +1244,7 @@ foreach ($showoptions as $optionname) {
break
;
break
;
case
'block_bad_words'
:
case
'block_bad_words'
:
case
'block_bad_usernames'
:
$optionfield
[
'style'
]
=
'tall'
;
$optionfield
[
'style'
]
=
'tall'
;
$optionfield
[
'rows'
]
=
4
;
$optionfield
[
'rows'
]
=
4
;
$optionfield
[
'note'
]
=
qa_lang_html
(
'admin/block_words_note'
);
$optionfield
[
'note'
]
=
qa_lang_html
(
'admin/block_words_note'
);
...
...
qa-include/plugins/qa-filter-basic.php
View file @
5ebb1854
...
@@ -52,6 +52,12 @@ class qa_filter_basic
...
@@ -52,6 +52,12 @@ class qa_filter_basic
if
(
qa_strlen
(
$handle
)
>
QA_DB_MAX_HANDLE_LENGTH
)
{
if
(
qa_strlen
(
$handle
)
>
QA_DB_MAX_HANDLE_LENGTH
)
{
return
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_HANDLE_LENGTH
);
return
qa_lang_sub
(
'main/max_length_x'
,
QA_DB_MAX_HANDLE_LENGTH
);
}
}
// check for banned usernames (e.g. "anonymous")
$wordspreg
=
qa_block_words_to_preg
(
qa_opt
(
'block_bad_usernames'
));
$blocked
=
qa_block_words_match_all
(
$handle
,
$wordspreg
);
if
(
!
empty
(
$blocked
))
{
return
qa_lang
(
'users/handle_blocked'
);
}
}
}
public
function
filter_question
(
&
$question
,
&
$errors
,
$oldquestion
)
public
function
filter_question
(
&
$question
,
&
$errors
,
$oldquestion
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment