|
104 | 104 | $in['tags'] = qa_get_tags_field_value('tags'); |
105 | 105 | } |
106 | 106 |
|
| 107 | +$errors = array(); |
| 108 | + |
107 | 109 | if (qa_clicked('doask')) { |
108 | 110 | require_once QA_INCLUDE_DIR.'app/post-create.php'; |
109 | 111 | require_once QA_INCLUDE_DIR.'util/string.php'; |
|
118 | 120 |
|
119 | 121 | qa_get_post_content('editor', 'content', $in['editor'], $in['content'], $in['format'], $in['text']); |
120 | 122 |
|
121 | | - $errors = array(); |
122 | 123 |
|
123 | 124 | if (!qa_check_form_security_code('ask', qa_post_text('code'))) { |
124 | 125 | $errors['page'] = qa_lang_html('misc/form_security_again'); |
|
181 | 182 | $qa_content = qa_content_prepare(false, array_keys(qa_category_path($categories, @$in['categoryid']))); |
182 | 183 |
|
183 | 184 | $qa_content['title'] = qa_lang_html(isset($followanswer) ? 'question/ask_follow_title' : 'question/ask_title'); |
184 | | -$qa_content['error'] = @$errors['page']; |
| 185 | +$qa_content['error'] = isset($errors['page']) ? $errors['page'] : null; |
185 | 186 |
|
186 | 187 | $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_qs'); |
187 | 188 | $editor = qa_load_editor(@$in['content'], @$in['format'], $editorname); |
188 | 189 |
|
189 | 190 | $field = qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'content', 12, false); |
190 | 191 | $field['label'] = qa_lang_html('question/q_content_label'); |
191 | | -$field['error'] = qa_html(@$errors['content']); |
| 192 | +$field['error'] = qa_html(isset($errors['content']) ? $errors['content'] : null); |
192 | 193 |
|
193 | 194 | $custom = qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : ''; |
194 | 195 |
|
|
207 | 208 | 'label' => qa_lang_html('question/q_title_label'), |
208 | 209 | 'tags' => 'name="title" id="title" autocomplete="off"', |
209 | 210 | 'value' => qa_html(@$in['title']), |
210 | | - 'error' => qa_html(@$errors['title']), |
| 211 | + 'error' => qa_html(isset($errors['title']) ? $errors['title'] : null), |
211 | 212 | ), |
212 | 213 |
|
213 | 214 | 'similar' => array( |
|
260 | 261 | if (qa_using_categories() && count($categories)) { |
261 | 262 | $field = array( |
262 | 263 | 'label' => qa_lang_html('question/q_category_label'), |
263 | | - 'error' => qa_html(@$errors['categoryid']), |
| 264 | + 'error' => qa_html(isset($errors['categoryid']) ? $errors['categoryid'] : null), |
264 | 265 | ); |
265 | 266 |
|
266 | 267 | qa_set_up_category_field($qa_content, $field, 'category', $categories, $in['categoryid'], true, qa_opt('allow_no_sub_category')); |
|
276 | 277 | 'label' => qa_html(qa_opt('extra_field_prompt')), |
277 | 278 | 'tags' => 'name="extra"', |
278 | 279 | 'value' => qa_html(@$in['extra']), |
279 | | - 'error' => qa_html(@$errors['extra']), |
| 280 | + 'error' => qa_html(isset($errors['extra']) ? $errors['extra'] : null), |
280 | 281 | ); |
281 | 282 |
|
282 | 283 | qa_array_insert($qa_content['form']['fields'], null, array('extra' => $field)); |
283 | 284 | } |
284 | 285 |
|
285 | 286 | if (qa_using_tags()) { |
286 | 287 | $field = array( |
287 | | - 'error' => qa_html(@$errors['tags']), |
| 288 | + 'error' => qa_html(isset($errors['tags']) ? $errors['tags'] : null), |
288 | 289 | ); |
289 | 290 |
|
290 | 291 | qa_set_up_tag_field($qa_content, $field, 'tags', isset($in['tags']) ? $in['tags'] : array(), array(), |
|
298 | 299 | } |
299 | 300 |
|
300 | 301 | qa_set_up_notify_fields($qa_content, $qa_content['form']['fields'], 'Q', qa_get_logged_in_email(), |
301 | | - isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), @$in['email'], @$errors['email']); |
| 302 | + isset($in['notify']) ? $in['notify'] : qa_opt('notify_users_default'), @$in['email'], isset($errors['email']) ? $errors['email'] : null); |
302 | 303 |
|
303 | 304 | if ($captchareason) { |
304 | 305 | require_once QA_INCLUDE_DIR.'app/captcha.php'; |
305 | | - qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors, qa_captcha_reason_note($captchareason)); |
| 306 | + qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], $errors, qa_captcha_reason_note($captchareason)); |
306 | 307 | } |
307 | 308 |
|
308 | 309 | $qa_content['focusid'] = 'title'; |
|
0 commit comments