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
f7e0e020
Commit
f7e0e020
authored
Dec 29, 2015
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (pages/ask)
parent
35e0531f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
205 additions
and
198 deletions
+205
-198
ask.php
qa-include/pages/ask.php
+205
-198
No files found.
qa-include/pages/ask.php
View file @
f7e0e020
...
...
@@ -20,279 +20,287 @@
More about this license: http://www.question2answer.org/license.php
*/
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
if
(
!
defined
(
'QA_VERSION'
))
{
// don't allow this page to be requested directly from browser
header
(
'Location: ../'
);
exit
;
}
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/limits.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'util/sort.php'
;
require_once
QA_INCLUDE_DIR
.
'app/format.php'
;
require_once
QA_INCLUDE_DIR
.
'app/limits.php'
;
require_once
QA_INCLUDE_DIR
.
'db/selects.php'
;
require_once
QA_INCLUDE_DIR
.
'util/sort.php'
;
// Check whether this is a follow-on question and get some info we need from the database
$in
=
array
();
// Check whether this is a follow-on question and get some info we need from the database
$followpostid
=
qa_get
(
'follow'
);
$in
[
'categoryid'
]
=
qa_clicked
(
'doask'
)
?
qa_get_category_field_value
(
'category'
)
:
qa_get
(
'cat'
);
$userid
=
qa_get_logged_in_userid
();
$in
=
array
();
list
(
$categories
,
$followanswer
,
$completetags
)
=
qa_db_select_with_pending
(
qa_db_category_nav_selectspec
(
$in
[
'categoryid'
],
true
),
isset
(
$followpostid
)
?
qa_db_full_post_selectspec
(
$userid
,
$followpostid
)
:
null
,
qa_db_popular_tags_selectspec
(
0
,
QA_DB_RETRIEVE_COMPLETE_TAGS
)
);
$followpostid
=
qa_get
(
'follow'
);
$in
[
'categoryid'
]
=
qa_clicked
(
'doask'
)
?
qa_get_category_field_value
(
'category'
)
:
qa_get
(
'cat'
);
$userid
=
qa_get_logged_in_userid
();
if
(
!
isset
(
$categories
[
$in
[
'categoryid'
]]))
$in
[
'categoryid'
]
=
null
;
list
(
$categories
,
$followanswer
,
$completetags
)
=
qa_db_select_with_pending
(
qa_db_category_nav_selectspec
(
$in
[
'categoryid'
],
true
),
isset
(
$followpostid
)
?
qa_db_full_post_selectspec
(
$userid
,
$followpostid
)
:
null
,
qa_db_popular_tags_selectspec
(
0
,
QA_DB_RETRIEVE_COMPLETE_TAGS
)
);
if
(
@
$followanswer
[
'basetype'
]
!=
'A'
)
$followanswer
=
null
;
if
(
!
isset
(
$categories
[
$in
[
'categoryid'
]]))
{
$in
[
'categoryid'
]
=
null
;
}
if
(
@
$followanswer
[
'basetype'
]
!=
'A'
)
{
$followanswer
=
null
;
}
// Check for permission error
$permiterror
=
qa_user_maximum_permit_error
(
'permit_post_q'
,
QA_LIMIT_QUESTIONS
);
// Check for permission error
if
(
$permiterror
)
{
$qa_content
=
qa_content_prepare
();
$permiterror
=
qa_user_maximum_permit_error
(
'permit_post_q'
,
QA_LIMIT_QUESTIONS
);
// The 'approve', 'login', 'confirm', 'limit', 'userblock', 'ipblock' permission errors are reported to the user here
// The other option ('level') prevents the menu option being shown, in qa_content_prepare(...)
if
(
$permiterror
)
{
$qa_content
=
qa_content_prepare
();
switch
(
$permiterror
)
{
case
'login'
:
$qa_content
[
'error'
]
=
qa_insert_login_links
(
qa_lang_html
(
'question/ask_must_login'
),
qa_request
(),
isset
(
$followpostid
)
?
array
(
'follow'
=>
$followpostid
)
:
null
);
break
;
// The 'approve', 'login', 'confirm', 'limit', 'userblock', 'ipblock' permission errors are reported to the user here
// The other option ('level') prevents the menu option being shown, in qa_content_prepare(...)
case
'confirm'
:
$qa_content
[
'error'
]
=
qa_insert_login_links
(
qa_lang_html
(
'question/ask_must_confirm'
),
qa_request
(),
isset
(
$followpostid
)
?
array
(
'follow'
=>
$followpostid
)
:
null
);
break
;
switch
(
$permiterror
)
{
case
'login'
:
$qa_content
[
'error'
]
=
qa_insert_login_links
(
qa_lang_html
(
'question/ask_must_login'
),
qa_request
(),
isset
(
$followpostid
)
?
array
(
'follow'
=>
$followpostid
)
:
null
);
break
;
case
'limit
'
:
$qa_content
[
'error'
]
=
qa_lang_html
(
'question/ask_limit'
);
break
;
case
'confirm
'
:
$qa_content
[
'error'
]
=
qa_insert_login_links
(
qa_lang_html
(
'question/ask_must_confirm'
),
qa_request
(),
isset
(
$followpostid
)
?
array
(
'follow'
=>
$followpostid
)
:
null
);
break
;
case
'approve
'
:
$qa_content
[
'error'
]
=
qa_lang_html
(
'question/ask_must_be_approved
'
);
break
;
case
'limit
'
:
$qa_content
[
'error'
]
=
qa_lang_html
(
'question/ask_limit
'
);
break
;
default
:
$qa_content
[
'error'
]
=
qa_lang_html
(
'users/no_permission'
);
break
;
}
case
'approve'
:
$qa_content
[
'error'
]
=
qa_lang_html
(
'question/ask_must_be_approved'
);
break
;
return
$qa_content
;
default
:
$qa_content
[
'error'
]
=
qa_lang_html
(
'users/no_permission'
);
break
;
}
return
$qa_content
;
}
// Process input
$captchareason
=
qa_user_captcha_reason
();
$in
[
'title'
]
=
qa_post_text
(
'title'
);
// allow title and tags to be posted by an external form
$in
[
'extra'
]
=
qa_opt
(
'extra_field_active'
)
?
qa_post_text
(
'extra'
)
:
null
;
if
(
qa_using_tags
())
$in
[
'tags'
]
=
qa_get_tags_field_value
(
'tags'
);
if
(
qa_clicked
(
'doask'
))
{
require_once
QA_INCLUDE_DIR
.
'app/post-create.php'
;
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
// Process input
$categoryids
=
array_keys
(
qa_category_path
(
$categories
,
@
$in
[
'categoryid'
]));
$userlevel
=
qa_user_level_for_categories
(
$categoryids
);
$captchareason
=
qa_user_captcha_reason
();
$in
[
'name'
]
=
qa_post_text
(
'name'
);
$in
[
'notify'
]
=
strlen
(
qa_post_text
(
'notify'
))
>
0
;
$in
[
'email'
]
=
qa_post_text
(
'email'
);
$in
[
'queued'
]
=
qa_user_moderation_reason
(
$userlevel
)
!==
false
;
$in
[
'title'
]
=
qa_post_text
(
'title'
);
// allow title and tags to be posted by an external form
$in
[
'extra'
]
=
qa_opt
(
'extra_field_active'
)
?
qa_post_text
(
'extra'
)
:
null
;
qa_get_post_content
(
'editor'
,
'content'
,
$in
[
'editor'
],
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
]);
if
(
qa_using_tags
())
{
$in
[
'tags'
]
=
qa_get_tags_field_value
(
'tags'
);
}
$errors
=
array
();
if
(
qa_clicked
(
'doask'
))
{
require_once
QA_INCLUDE_DIR
.
'app/post-create.php'
;
require_once
QA_INCLUDE_DIR
.
'util/string.php'
;
if
(
!
qa_check_form_security_code
(
'ask'
,
qa_post_text
(
'code'
)))
$errors
[
'page'
]
=
qa_lang_html
(
'misc/form_security_again'
);
$categoryids
=
array_keys
(
qa_category_path
(
$categories
,
@
$in
[
'categoryid'
]));
$userlevel
=
qa_user_level_for_categories
(
$categoryids
);
else
{
$filtermodules
=
qa_load_modules_with
(
'filter'
,
'filter_question'
);
foreach
(
$filtermodules
as
$filtermodule
)
{
$oldin
=
$in
;
$filtermodule
->
filter_question
(
$in
,
$errors
,
null
);
qa_update_post_text
(
$in
,
$oldin
);
}
$in
[
'name'
]
=
qa_post_text
(
'name'
);
$in
[
'notify'
]
=
strlen
(
qa_post_text
(
'notify'
))
>
0
;
$in
[
'email'
]
=
qa_post_text
(
'email'
);
$in
[
'queued'
]
=
qa_user_moderation_reason
(
$userlevel
)
!==
false
;
if
(
qa_using_categories
()
&&
count
(
$categories
)
&&
(
!
qa_opt
(
'allow_no_category'
))
&&
!
isset
(
$in
[
'categoryid'
]))
$errors
[
'categoryid'
]
=
qa_lang_html
(
'question/category_required'
);
// check this here because we need to know count($categories)
elseif
(
qa_user_permit_error
(
'permit_post_q'
,
null
,
$userlevel
))
$errors
[
'categoryid'
]
=
qa_lang_html
(
'question/category_ask_not_allowed'
);
qa_get_post_content
(
'editor'
,
'content'
,
$in
[
'editor'
],
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
]);
if
(
$captchareason
)
{
require_once
QA_INCLUDE_DIR
.
'app/captcha.php'
;
qa_captcha_validate_post
(
$errors
);
}
$errors
=
array
();
if
(
empty
(
$errors
))
{
//check if the question is already posted
$testwords
=
implode
(
' '
,
qa_string_to_words
(
$in
[
'content'
]));
$recent_questions
=
qa_db_select_with_pending
(
qa_db_qs_selectspec
(
null
,
'created'
,
0
,
null
,
null
,
false
,
true
,
5
));
foreach
(
$recent_questions
as
$recent_question
)
if
(
!
$recent_question
[
'hidden'
])
if
(
implode
(
' '
,
qa_string_to_words
(
$recent_question
[
'content'
]))
==
$testwords
){
$errors
[
'page'
]
=
qa_lang_html
(
'question/duplicate_content'
);
break
;
}
}
if
(
!
qa_check_form_security_code
(
'ask'
,
qa_post_text
(
'code'
)))
{
$errors
[
'page'
]
=
qa_lang_html
(
'misc/form_security_again'
);
}
else
{
$filtermodules
=
qa_load_modules_with
(
'filter'
,
'filter_question'
);
foreach
(
$filtermodules
as
$filtermodule
)
{
$oldin
=
$in
;
$filtermodule
->
filter_question
(
$in
,
$errors
,
null
);
qa_update_post_text
(
$in
,
$oldin
);
}
if
(
empty
(
$errors
))
{
$cookieid
=
isset
(
$userid
)
?
qa_cookie_get
()
:
qa_cookie_get_create
();
// create a new cookie if necessary
if
(
qa_using_categories
()
&&
count
(
$categories
)
&&
(
!
qa_opt
(
'allow_no_category'
))
&&
!
isset
(
$in
[
'categoryid'
]))
{
// check this here because we need to know count($categories)
$errors
[
'categoryid'
]
=
qa_lang_html
(
'question/category_required'
);
}
elseif
(
qa_user_permit_error
(
'permit_post_q'
,
null
,
$userlevel
))
{
$errors
[
'categoryid'
]
=
qa_lang_html
(
'question/category_ask_not_allowed'
);
}
$questionid
=
qa_question_create
(
$followanswer
,
$userid
,
qa_get_logged_in_handle
(),
$cookieid
,
$in
[
'title'
],
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
],
isset
(
$in
[
'tags'
])
?
qa_tags_to_tagstring
(
$in
[
'tags'
])
:
''
,
$in
[
'notify'
],
$in
[
'email'
],
$in
[
'categoryid'
],
$in
[
'extra'
],
$in
[
'queued'
],
$in
[
'name'
]);
if
(
$captchareason
)
{
require_once
QA_INCLUDE_DIR
.
'app/captcha.php'
;
qa_captcha_validate_post
(
$errors
);
}
qa_redirect
(
qa_q_request
(
$questionid
,
$in
[
'title'
]));
// our work is done here
if
(
empty
(
$errors
))
{
// check if the question is already posted
$testwords
=
implode
(
' '
,
qa_string_to_words
(
$in
[
'content'
]));
$recent_questions
=
qa_db_select_with_pending
(
qa_db_qs_selectspec
(
null
,
'created'
,
0
,
null
,
null
,
false
,
true
,
5
));
foreach
(
$recent_questions
as
$question
)
{
if
(
!
$question
[
'hidden'
])
{
if
(
implode
(
' '
,
qa_string_to_words
(
$question
[
'content'
]))
==
$testwords
)
{
$errors
[
'page'
]
=
qa_lang_html
(
'question/duplicate_content'
);
break
;
}
}
}
}
}
if
(
empty
(
$errors
))
{
$cookieid
=
isset
(
$userid
)
?
qa_cookie_get
()
:
qa_cookie_get_create
();
// create a new cookie if necessary
// Prepare content for theme
$questionid
=
qa_question_create
(
$followanswer
,
$userid
,
qa_get_logged_in_handle
(),
$cookieid
,
$in
[
'title'
],
$in
[
'content'
],
$in
[
'format'
],
$in
[
'text'
],
isset
(
$in
[
'tags'
])
?
qa_tags_to_tagstring
(
$in
[
'tags'
])
:
''
,
$in
[
'notify'
],
$in
[
'email'
],
$in
[
'categoryid'
],
$in
[
'extra'
],
$in
[
'queued'
],
$in
[
'name'
]);
$qa_content
=
qa_content_prepare
(
false
,
array_keys
(
qa_category_path
(
$categories
,
@
$in
[
'categoryid'
])));
qa_redirect
(
qa_q_request
(
$questionid
,
$in
[
'title'
]));
// our work is done here
}
}
}
$qa_content
[
'title'
]
=
qa_lang_html
(
isset
(
$followanswer
)
?
'question/ask_follow_title'
:
'question/ask_title'
);
$qa_content
[
'error'
]
=@
$errors
[
'page'
];
$editorname
=
isset
(
$in
[
'editor'
])
?
$in
[
'editor'
]
:
qa_opt
(
'editor_for_qs'
);
$editor
=
qa_load_editor
(
@
$in
[
'content'
],
@
$in
[
'format'
],
$editorname
);
// Prepare content for theme
$field
=
qa_editor_load_field
(
$editor
,
$qa_content
,
@
$in
[
'content'
],
@
$in
[
'format'
],
'content'
,
12
,
false
);
$field
[
'label'
]
=
qa_lang_html
(
'question/q_content_label'
);
$field
[
'error'
]
=
qa_html
(
@
$errors
[
'content'
]);
$qa_content
=
qa_content_prepare
(
false
,
array_keys
(
qa_category_path
(
$categories
,
@
$in
[
'categoryid'
])));
$custom
=
qa_opt
(
'show_custom_ask'
)
?
trim
(
qa_opt
(
'custom_ask'
))
:
''
;
$qa_content
[
'title'
]
=
qa_lang_html
(
isset
(
$followanswer
)
?
'question/ask_follow_title'
:
'question/ask_title'
);
$qa_content
[
'error'
]
=
@
$errors
[
'page'
];
$qa_content
[
'form'
]
=
array
(
'tags'
=>
'name="ask" method="post" action="'
.
qa_self_html
()
.
'"'
,
$editorname
=
isset
(
$in
[
'editor'
])
?
$in
[
'editor'
]
:
qa_opt
(
'editor_for_qs'
);
$editor
=
qa_load_editor
(
@
$in
[
'content'
],
@
$in
[
'format'
],
$editorname
);
'style'
=>
'tall'
,
$field
=
qa_editor_load_field
(
$editor
,
$qa_content
,
@
$in
[
'content'
],
@
$in
[
'format'
],
'content'
,
12
,
false
);
$field
[
'label'
]
=
qa_lang_html
(
'question/q_content_label'
);
$field
[
'error'
]
=
qa_html
(
@
$errors
[
'content'
]);
'fields'
=>
array
(
'custom'
=>
array
(
'type'
=>
'custom'
,
'note'
=>
$custom
,
),
$custom
=
qa_opt
(
'show_custom_ask'
)
?
trim
(
qa_opt
(
'custom_ask'
))
:
''
;
'title'
=>
array
(
'label'
=>
qa_lang_html
(
'question/q_title_label'
),
'tags'
=>
'name="title" id="title" autocomplete="off"'
,
'value'
=>
qa_html
(
@
$in
[
'title'
]),
'error'
=>
qa_html
(
@
$errors
[
'title'
]),
),
$qa_content
[
'form'
]
=
array
(
'tags'
=>
'name="ask" method="post" action="'
.
qa_self_html
()
.
'"'
,
'similar'
=>
array
(
'type'
=>
'custom'
,
'html'
=>
'<span id="similar"></span>'
,
),
'style'
=>
'tall'
,
'content'
=>
$field
,
'fields'
=>
array
(
'custom'
=>
array
(
'type'
=>
'custom'
,
'note'
=>
$custom
,
),
'buttons'
=>
array
(
'ask'
=>
array
(
'tags'
=>
'onclick="qa_show_waiting_after(this, false); '
.
(
method_exists
(
$editor
,
'update_script'
)
?
$editor
->
update_script
(
'content'
)
:
''
)
.
'"'
,
'label'
=>
qa_lang_html
(
'question/ask_button'
),
),
'title'
=>
array
(
'label'
=>
qa_lang_html
(
'question/q_title_label'
),
'tags'
=>
'name="title" id="title" autocomplete="off"'
,
'value'
=>
qa_html
(
@
$in
[
'title'
]),
'error'
=>
qa_html
(
@
$errors
[
'title'
]),
),
'hidden'
=>
array
(
'editor'
=>
qa_html
(
$editorname
),
'code'
=>
qa_get_form_security_code
(
'ask'
),
'doask'
=>
'1'
,
'similar'
=>
array
(
'type'
=>
'custom'
,
'html'
=>
'<span id="similar"></span>'
,
),
);
if
(
!
strlen
(
$custom
))
unset
(
$qa_content
[
'form'
][
'fields'
][
'custom'
]);
'content'
=>
$field
,
),
if
(
qa_opt
(
'do_ask_check_qs'
)
||
qa_opt
(
'do_example_tags'
))
{
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-ask.js?'
.
QA_VERSION
;
$qa_content
[
'form'
][
'fields'
][
'title'
][
'tags'
]
.=
' onchange="qa_title_change(this.value);"'
;
'buttons'
=>
array
(
'ask'
=>
array
(
'tags'
=>
'onclick="qa_show_waiting_after(this, false); '
.
(
method_exists
(
$editor
,
'update_script'
)
?
$editor
->
update_script
(
'content'
)
:
''
)
.
'"'
,
'label'
=>
qa_lang_html
(
'question/ask_button'
),
),
),
if
(
strlen
(
@
$in
[
'title'
]))
$qa_content
[
'script_onloads'
][]
=
'qa_title_change('
.
qa_js
(
$in
[
'title'
])
.
');'
;
}
'hidden'
=>
array
(
'editor'
=>
qa_html
(
$editorname
),
'code'
=>
qa_get_form_security_code
(
'ask'
),
'doask'
=>
'1'
,
),
);
if
(
isset
(
$followanswer
))
{
$viewer
=
qa_load_viewer
(
$followanswer
[
'content'
],
$followanswer
[
'format'
]);
if
(
!
strlen
(
$custom
))
{
unset
(
$qa_content
[
'form'
][
'fields'
][
'custom'
]);
}
$field
=
array
(
'type'
=>
'static'
,
'label'
=>
qa_lang_html
(
'question/ask_follow_from_a'
),
'value'
=>
$viewer
->
get_html
(
$followanswer
[
'content'
],
$followanswer
[
'format'
],
array
(
'blockwordspreg'
=>
qa_get_block_words_preg
())),
);
if
(
qa_opt
(
'do_ask_check_qs'
)
||
qa_opt
(
'do_example_tags'
))
{
$qa_content
[
'script_rel'
][]
=
'qa-content/qa-ask.js?'
.
QA_VERSION
;
$qa_content
[
'form'
][
'fields'
][
'title'
][
'tags'
]
.=
' onchange="qa_title_change(this.value);"'
;
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
'title'
,
array
(
'follows'
=>
$field
));
if
(
strlen
(
@
$in
[
'title'
]))
{
$qa_content
[
'script_onloads'
][]
=
'qa_title_change('
.
qa_js
(
$in
[
'title'
])
.
');'
;
}
}
if
(
qa_using_categories
()
&&
count
(
$categories
))
{
$field
=
array
(
'label'
=>
qa_lang_html
(
'question/q_category_label'
),
'error'
=>
qa_html
(
@
$errors
[
'categoryid'
]),
);
if
(
isset
(
$followanswer
))
{
$viewer
=
qa_load_viewer
(
$followanswer
[
'content'
],
$followanswer
[
'format'
]);
qa_set_up_category_field
(
$qa_content
,
$field
,
'category'
,
$categories
,
$in
[
'categoryid'
],
true
,
qa_opt
(
'allow_no_sub_category'
));
$field
=
array
(
'type'
=>
'static'
,
'label'
=>
qa_lang_html
(
'question/ask_follow_from_a'
),
'value'
=>
$viewer
->
get_html
(
$followanswer
[
'content'
],
$followanswer
[
'format'
],
array
(
'blockwordspreg'
=>
qa_get_block_words_preg
())),
);
if
(
!
qa_opt
(
'allow_no_category'
))
// don't auto-select a category even though one is required
$field
[
'options'
][
''
]
=
''
;
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
'title'
,
array
(
'follows'
=>
$field
));
}
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
'content'
,
array
(
'category'
=>
$field
));
}
if
(
qa_using_categories
()
&&
count
(
$categories
))
{
$field
=
array
(
'label'
=>
qa_lang_html
(
'question/q_category_label'
),
'error'
=>
qa_html
(
@
$errors
[
'categoryid'
]),
);
if
(
qa_opt
(
'extra_field_active'
))
{
$field
=
array
(
'label'
=>
qa_html
(
qa_opt
(
'extra_field_prompt'
)),
'tags'
=>
'name="extra"'
,
'value'
=>
qa_html
(
@
$in
[
'extra'
]),
'error'
=>
qa_html
(
@
$errors
[
'extra'
]),
);
qa_set_up_category_field
(
$qa_content
,
$field
,
'category'
,
$categories
,
$in
[
'categoryid'
],
true
,
qa_opt
(
'allow_no_sub_category'
));
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
null
,
array
(
'extra'
=>
$field
));
}
if
(
!
qa_opt
(
'allow_no_category'
))
// don't auto-select a category even though one is required
$field
[
'options'
][
''
]
=
''
;
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
'content'
,
array
(
'category'
=>
$field
));
}
if
(
qa_using_tags
())
{
$field
=
array
(
'error'
=>
qa_html
(
@
$errors
[
'tags'
]),
);
if
(
qa_opt
(
'extra_field_active'
))
{
$field
=
array
(
'label'
=>
qa_html
(
qa_opt
(
'extra_field_prompt'
)),
'tags'
=>
'name="extra"'
,
'value'
=>
qa_html
(
@
$in
[
'extra'
]),
'error'
=>
qa_html
(
@
$errors
[
'extra'
]),
);
qa_set_up_tag_field
(
$qa_content
,
$field
,
'tags'
,
isset
(
$in
[
'tags'
])
?
$in
[
'tags'
]
:
array
(),
array
(),
qa_opt
(
'do_complete_tags'
)
?
array_keys
(
$completetags
)
:
array
(),
qa_opt
(
'page_size_ask_tags'
));
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
null
,
array
(
'extra'
=>
$field
));
}
qa_array_insert
(
$qa_content
[
'form'
][
'fields'
],
null
,
array
(
'tags'
=>
$field
));
}
if
(
qa_using_tags
())
{
$field
=
array
(
'error'
=>
qa_html
(
@
$errors
[
'tags'
]),
);
if
(
!
isset
(
$userid
))
qa_
set_up_name_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
@
$in
[
'name'
]
);
qa_set_up_tag_field
(
$qa_content
,
$field
,
'tags'
,
isset
(
$in
[
'tags'
])
?
$in
[
'tags'
]
:
array
(),
array
(),
qa_
opt
(
'do_complete_tags'
)
?
array_keys
(
$completetags
)
:
array
(),
qa_opt
(
'page_size_ask_tags'
)
);
qa_
set_up_notify_fields
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
'Q'
,
qa_get_logged_in_email
(),
isset
(
$in
[
'notify'
])
?
$in
[
'notify'
]
:
qa_opt
(
'notify_users_default'
),
@
$in
[
'email'
],
@
$errors
[
'email'
]);
qa_
array_insert
(
$qa_content
[
'form'
][
'fields'
],
null
,
array
(
'tags'
=>
$field
));
}
if
(
$captchareason
)
{
require_once
QA_INCLUDE_DIR
.
'app/captcha.php'
;
qa_set_up_captcha_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
@
$errors
,
qa_captcha_reason_note
(
$captchareason
));
}
if
(
!
isset
(
$userid
))
{
qa_set_up_name_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
@
$in
[
'name'
]);
}
$qa_content
[
'focusid'
]
=
'title'
;
qa_set_up_notify_fields
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
'Q'
,
qa_get_logged_in_email
(),
isset
(
$in
[
'notify'
])
?
$in
[
'notify'
]
:
qa_opt
(
'notify_users_default'
),
@
$in
[
'email'
],
@
$errors
[
'email'
]);
if
(
$captchareason
)
{
require_once
QA_INCLUDE_DIR
.
'app/captcha.php'
;
qa_set_up_captcha_field
(
$qa_content
,
$qa_content
[
'form'
][
'fields'
],
@
$errors
,
qa_captcha_reason_note
(
$captchareason
));
}
return
$qa_content
;
$qa_content
[
'focusid'
]
=
'title'
;
/*
Omit PHP closing tag to help avoid accidental output
*/
\ No newline at end of file
return
$qa_content
;
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