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
4060d1fe
Commit
4060d1fe
authored
Mar 13, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle allow_anonymous_naming option
Show/hide field and handle security on backend.
parent
267c11b9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
ask.php
qa-include/pages/ask.php
+2
-2
question-post.php
qa-include/pages/question-post.php
+6
-6
question-submit.php
qa-include/pages/question-submit.php
+2
-2
question-view.php
qa-include/pages/question-view.php
+2
-2
No files found.
qa-include/pages/ask.php
View file @
4060d1fe
...
@@ -109,7 +109,7 @@ if (qa_clicked('doask')) {
...
@@ -109,7 +109,7 @@ if (qa_clicked('doask')) {
$categoryids
=
array_keys
(
qa_category_path
(
$categories
,
@
$in
[
'categoryid'
]));
$categoryids
=
array_keys
(
qa_category_path
(
$categories
,
@
$in
[
'categoryid'
]));
$userlevel
=
qa_user_level_for_categories
(
$categoryids
);
$userlevel
=
qa_user_level_for_categories
(
$categoryids
);
$in
[
'name'
]
=
qa_
post_text
(
'name'
)
;
$in
[
'name'
]
=
qa_
opt
(
'allow_anonymous_naming'
)
?
qa_post_text
(
'name'
)
:
null
;
$in
[
'notify'
]
=
strlen
(
qa_post_text
(
'notify'
))
>
0
;
$in
[
'notify'
]
=
strlen
(
qa_post_text
(
'notify'
))
>
0
;
$in
[
'email'
]
=
qa_post_text
(
'email'
);
$in
[
'email'
]
=
qa_post_text
(
'email'
);
$in
[
'queued'
]
=
qa_user_moderation_reason
(
$userlevel
)
!==
false
;
$in
[
'queued'
]
=
qa_user_moderation_reason
(
$userlevel
)
!==
false
;
...
@@ -292,7 +292,7 @@ if (qa_using_tags()) {
...
@@ -292,7 +292,7 @@ if (qa_using_tags()) {
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
null
,
array
(
'tags'
=>
$field
));
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
null
,
array
(
'tags'
=>
$field
));
}
}
if
(
!
isset
(
$userid
))
{
if
(
!
isset
(
$userid
)
&&
qa_opt
(
'allow_anonymous_naming'
)
)
{
qa_set_up_name_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
@
$in
[
'name'
]);
qa_set_up_name_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
@
$in
[
'name'
]);
}
}
...
...
qa-include/pages/question-post.php
View file @
4060d1fe
...
@@ -390,7 +390,7 @@ function qa_page_q_edit_q_form(&$qa_content, $question, $in, $errors, $completet
...
@@ -390,7 +390,7 @@ function qa_page_q_edit_q_form(&$qa_content, $question, $in, $errors, $completet
}
}
if
(
$question
[
'isbyuser'
])
{
if
(
$question
[
'isbyuser'
])
{
if
(
!
qa_is_logged_in
())
if
(
!
qa_is_logged_in
()
&&
qa_opt
(
'allow_anonymous_naming'
)
)
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
isset
(
$in
[
'name'
])
?
$in
[
'name'
]
:
@
$question
[
'name'
],
'q_'
);
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
isset
(
$in
[
'name'
])
?
$in
[
'name'
]
:
@
$question
[
'name'
],
'q_'
);
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'Q'
,
qa_get_logged_in_email
(),
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'Q'
,
qa_get_logged_in_email
(),
...
@@ -441,7 +441,7 @@ function qa_page_q_edit_q_submit($question, $answers, $commentsfollows, $closepo
...
@@ -441,7 +441,7 @@ function qa_page_q_edit_q_submit($question, $answers, $commentsfollows, $closepo
$userlevel
=
null
;
$userlevel
=
null
;
if
(
$question
[
'isbyuser'
])
{
if
(
$question
[
'isbyuser'
])
{
$in
[
'name'
]
=
qa_
post_text
(
'q_name'
)
;
$in
[
'name'
]
=
qa_
opt
(
'allow_anonymous_naming'
)
?
qa_post_text
(
'q_name'
)
:
null
;
$in
[
'notify'
]
=
qa_post_text
(
'q_notify'
)
!==
null
;
$in
[
'notify'
]
=
qa_post_text
(
'q_notify'
)
!==
null
;
$in
[
'email'
]
=
qa_post_text
(
'q_email'
);
$in
[
'email'
]
=
qa_post_text
(
'q_email'
);
}
}
...
@@ -730,7 +730,7 @@ function qa_page_q_edit_a_form(&$qa_content, $id, $answer, $question, $answers,
...
@@ -730,7 +730,7 @@ function qa_page_q_edit_a_form(&$qa_content, $id, $answer, $question, $answers,
// Show name and notification field if appropriate
// Show name and notification field if appropriate
if
(
$answer
[
'isbyuser'
])
{
if
(
$answer
[
'isbyuser'
])
{
if
(
!
qa_is_logged_in
())
if
(
!
qa_is_logged_in
()
&&
qa_opt
(
'allow_anonymous_naming'
)
)
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
isset
(
$in
[
'name'
])
?
$in
[
'name'
]
:
@
$answer
[
'name'
],
$prefix
);
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
isset
(
$in
[
'name'
])
?
$in
[
'name'
]
:
@
$answer
[
'name'
],
$prefix
);
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'A'
,
qa_get_logged_in_email
(),
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'A'
,
qa_get_logged_in_email
(),
...
@@ -765,7 +765,7 @@ function qa_page_q_edit_a_submit($answer, $question, $answers, $commentsfollows,
...
@@ -765,7 +765,7 @@ function qa_page_q_edit_a_submit($answer, $question, $answers, $commentsfollows,
);
);
if
(
$answer
[
'isbyuser'
])
{
if
(
$answer
[
'isbyuser'
])
{
$in
[
'name'
]
=
qa_
post_text
(
$prefix
.
'name'
)
;
$in
[
'name'
]
=
qa_
opt
(
'allow_anonymous_naming'
)
?
qa_post_text
(
$prefix
.
'name'
)
:
null
;
$in
[
'notify'
]
=
qa_post_text
(
$prefix
.
'notify'
)
!==
null
;
$in
[
'notify'
]
=
qa_post_text
(
$prefix
.
'notify'
)
!==
null
;
$in
[
'email'
]
=
qa_post_text
(
$prefix
.
'email'
);
$in
[
'email'
]
=
qa_post_text
(
$prefix
.
'email'
);
}
}
...
@@ -936,7 +936,7 @@ function qa_page_q_edit_c_form(&$qa_content, $id, $comment, $in, $errors)
...
@@ -936,7 +936,7 @@ function qa_page_q_edit_c_form(&$qa_content, $id, $comment, $in, $errors)
);
);
if
(
$comment
[
'isbyuser'
])
{
if
(
$comment
[
'isbyuser'
])
{
if
(
!
qa_is_logged_in
())
if
(
!
qa_is_logged_in
()
&&
qa_opt
(
'allow_anonymous_naming'
)
)
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
isset
(
$in
[
'name'
])
?
$in
[
'name'
]
:
@
$comment
[
'name'
],
$prefix
);
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
isset
(
$in
[
'name'
])
?
$in
[
'name'
]
:
@
$comment
[
'name'
],
$prefix
);
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'C'
,
qa_get_logged_in_email
(),
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'C'
,
qa_get_logged_in_email
(),
...
@@ -968,7 +968,7 @@ function qa_page_q_edit_c_submit($comment, $question, $parent, &$in, &$errors)
...
@@ -968,7 +968,7 @@ function qa_page_q_edit_c_submit($comment, $question, $parent, &$in, &$errors)
$in
=
array
();
$in
=
array
();
if
(
$comment
[
'isbyuser'
])
{
if
(
$comment
[
'isbyuser'
])
{
$in
[
'name'
]
=
qa_
post_text
(
$prefix
.
'name'
)
;
$in
[
'name'
]
=
qa_
opt
(
'allow_anonymous_naming'
)
?
qa_post_text
(
$prefix
.
'name'
)
:
null
;
$in
[
'notify'
]
=
qa_post_text
(
$prefix
.
'notify'
)
!==
null
;
$in
[
'notify'
]
=
qa_post_text
(
$prefix
.
'notify'
)
!==
null
;
$in
[
'email'
]
=
qa_post_text
(
$prefix
.
'email'
);
$in
[
'email'
]
=
qa_post_text
(
$prefix
.
'email'
);
}
}
...
...
qa-include/pages/question-submit.php
View file @
4060d1fe
...
@@ -352,7 +352,7 @@ function qa_page_q_click_check_form_code($post, &$error)
...
@@ -352,7 +352,7 @@ function qa_page_q_click_check_form_code($post, &$error)
function
qa_page_q_add_a_submit
(
$question
,
$answers
,
$usecaptcha
,
&
$in
,
&
$errors
)
function
qa_page_q_add_a_submit
(
$question
,
$answers
,
$usecaptcha
,
&
$in
,
&
$errors
)
{
{
$in
=
array
(
$in
=
array
(
'name'
=>
qa_
post_text
(
'a_name'
)
,
'name'
=>
qa_
opt
(
'allow_anonymous_naming'
)
?
qa_post_text
(
'a_name'
)
:
null
,
'notify'
=>
qa_post_text
(
'a_notify'
)
!==
null
,
'notify'
=>
qa_post_text
(
'a_notify'
)
!==
null
,
'email'
=>
qa_post_text
(
'a_email'
),
'email'
=>
qa_post_text
(
'a_email'
),
'queued'
=>
qa_user_moderation_reason
(
qa_user_level_for_post
(
$question
))
!==
false
,
'queued'
=>
qa_user_moderation_reason
(
qa_user_level_for_post
(
$question
))
!==
false
,
...
@@ -440,7 +440,7 @@ function qa_page_q_add_c_submit($question, $parent, $commentsfollows, $usecaptch
...
@@ -440,7 +440,7 @@ function qa_page_q_add_c_submit($question, $parent, $commentsfollows, $usecaptch
$prefix
=
'c'
.
$parentid
.
'_'
;
$prefix
=
'c'
.
$parentid
.
'_'
;
$in
=
array
(
$in
=
array
(
'name'
=>
qa_
post_text
(
$prefix
.
'name'
)
,
'name'
=>
qa_
opt
(
'allow_anonymous_naming'
)
?
qa_post_text
(
$prefix
.
'name'
)
:
null
,
'notify'
=>
qa_post_text
(
$prefix
.
'notify'
)
!==
null
,
'notify'
=>
qa_post_text
(
$prefix
.
'notify'
)
!==
null
,
'email'
=>
qa_post_text
(
$prefix
.
'email'
),
'email'
=>
qa_post_text
(
$prefix
.
'email'
),
'queued'
=>
qa_user_moderation_reason
(
qa_user_level_for_post
(
$parent
))
!==
false
,
'queued'
=>
qa_user_moderation_reason
(
qa_user_level_for_post
(
$parent
))
!==
false
,
...
...
qa-include/pages/question-view.php
View file @
4060d1fe
...
@@ -959,7 +959,7 @@ function qa_page_q_add_a_form(&$qa_content, $formid, $captchareason, $question,
...
@@ -959,7 +959,7 @@ function qa_page_q_add_a_form(&$qa_content, $formid, $captchareason, $question,
'label'
=>
qa_lang_html
(
'main/cancel_button'
),
'label'
=>
qa_lang_html
(
'main/cancel_button'
),
);
);
if
(
!
qa_is_logged_in
())
if
(
!
qa_is_logged_in
()
&&
qa_opt
(
'allow_anonymous_naming'
)
)
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
@
$in
[
'name'
],
'a_'
);
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
@
$in
[
'name'
],
'a_'
);
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'A'
,
qa_get_logged_in_email
(),
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'A'
,
qa_get_logged_in_email
(),
...
@@ -1104,7 +1104,7 @@ function qa_page_q_add_c_form(&$qa_content, $question, $parent, $formid, $captch
...
@@ -1104,7 +1104,7 @@ function qa_page_q_add_c_form(&$qa_content, $question, $parent, $formid, $captch
if
(
!
strlen
(
$custom
))
if
(
!
strlen
(
$custom
))
unset
(
$form
[
'fields'
][
'custom'
]);
unset
(
$form
[
'fields'
][
'custom'
]);
if
(
!
qa_is_logged_in
())
if
(
!
qa_is_logged_in
()
&&
qa_opt
(
'allow_anonymous_naming'
)
)
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
@
$in
[
'name'
],
$prefix
);
qa_set_up_name_field
(
$qa_content
,
$form
[
'fields'
],
@
$in
[
'name'
],
$prefix
);
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'C'
,
qa_get_logged_in_email
(),
qa_set_up_notify_fields
(
$qa_content
,
$form
[
'fields'
],
'C'
,
qa_get_logged_in_email
(),
...
...
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