if (!titania::$config->allow_self_validation && phpbb::$user->data['user_type'] != USER_FOUNDER && $action == 'approve' && ($contrib->is_author || $contrib->is_active_coauthor || $contrib->is_coauthor)) { titania::needs_auth(); } if (!titania_types::$types[$contrib->contrib_type]->acl_get('validate')) { titania::needs_auth(); } // Load the message object for the validation reason $queue->message_fields_prefix = 'message_validation'; $message_object = new titania_message($queue); $message_object->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies'))); $message_object->set_settings(array('display_subject' => false)); $error = array(); $public_notes = utf8_normalize_nfc(request_var('public_notes', '', true)); if ($message_object->submit_check()) { // Check form key if (($form_error = $message_object->validate_form_key()) !== false) { $error[] = $form_error; } if (!sizeof($error)) { if ($action == 'approve') { $queue->approve($public_notes); // Install the style on the demo board? if ($contrib->contrib_type == TITANIA_TYPE_STYLE && isset($_POST['style_demo_install']) && titania::$config->demo_style_path) { // Reload the contrib, it hath changed $contrib->load((int) $queue->contrib_id); $revision = $queue->get_revision(); $sql = 'SELECT attachment_directory, physical_filename FROM ' . TITANIA_ATTACHMENTS_TABLE . ' WHERE attachment_id = ' . (int) $revision->attachment_id; $result = phpbb::$db->sql_query($sql); $row = phpbb::$db->sql_fetchrow($result); phpbb::$db->sql_freeresult($result);
titania::$contrib->assign_details(true); switch ($action) { case 'create': case 'edit': if (!phpbb::$auth->acl_get('u_titania_mod_faq_mod') && !phpbb::$auth->acl_get('u_titania_faq_' . $action) && !titania::$contrib->is_author && !titania::$contrib->is_active_coauthor) { titania::needs_auth(); } // Load the message object $message = new titania_message($faq); $message->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies'), 'attachments' => true)); // Submit check...handles running $faq->post_data() if required $submit = $message->submit_check(); $error = array_merge($error, $message->error); if ($submit) { $error = array_merge($error, $faq->validate()); if (($validate_form_key = $message->validate_form_key()) !== false) { $error[] = $validate_form_key; } if (!sizeof($error)) { $faq->submit(); $message->submit($faq->faq_id); $sql = 'SELECT right_id FROM ' . TITANIA_CONTRIB_FAQ_TABLE . ' WHERE contrib_id = ' . titania::$contrib->contrib_id . ' ORDER BY right_id DESC LIMIT 1'; $result = phpbb::$db->sql_query($sql); $right_id = (string) phpbb::$db->sql_fetchfield('right_id'); phpbb::$db->sql_freeresult($result); // Update the faqs table $sql_ary = array('left_id' => $right_id + 1, 'right_id' => $right_id + 2); $sql = 'UPDATE ' . TITANIA_CONTRIB_FAQ_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE faq_id = ' . (int) $faq->faq_id;