/** * Show bbcodes and smilies in the quickreply * Template data for Ajax submit * * @param object $event The event object * @return null * @access public */ public function viewtopic_modify_data($event) { $forum_id = $event['forum_id']; $topic_data = $event['topic_data']; $post_list = $event['post_list']; $topic_id = $topic_data['topic_id']; $s_quick_reply = false; if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) { // Quick reply enabled forum $s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false; } if (!$this->user->data['is_registered'] && $s_quick_reply) { add_form_key('posting'); $s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig'); $s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id); $s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id); $s_notify = false; $qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id); // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked !$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true; !$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true; !$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true; $s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true; $s_notify ? $qr_hidden_fields['notify'] = 1 : true; $topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true; $this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true))); if ($this->config['enable_post_confirm']) { $captcha = $this->captcha->get_instance($this->config['captcha_plugin']); $captcha->init(CONFIRM_POST); } if ($this->config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === false)) { $this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template())); } // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview if (isset($captcha) && $captcha->is_solved() !== false) { $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields())); } } // Ajaxify viewtopic data if ($this->request->is_ajax() && $this->request->is_set('qr_request')) { if (!$this->user->data['is_registered'] && $this->config['enable_post_confirm']) { $captcha = $this->captcha->get_instance($this->config['captcha_plugin']); $captcha->init(CONFIRM_POST); // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview if (isset($captcha) && $captcha->is_solved() !== false) { $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields())); } } // Fix issues if the inserted post is not the first. if ($this->qr_insert && !$this->qr_first) { $this->template->alter_block_array('postrow', array('S_FIRST_ROW' => false), false, 'change'); } $page_title = $event['page_title']; $this->template->assign_vars(array('S_QUICKREPLY_REQUEST' => true, 'S_QR_NO_FIRST_POST' => $this->qr_insert, 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote'])); $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list)))); // Output the page page_header($page_title, false, $forum_id); page_footer(false, false, false); $json_response = new \phpbb\json_response(); $json_response->send(array('success' => true, 'result' => $this->template->assign_display('@tatiana5_quickreply/quickreply_template.html', '', true), 'insert' => $this->qr_insert)); } if ($s_quick_reply) { include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext; // HTML, BBCode, Smilies, Images and Flash status $bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false; $smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false; $img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false; $url_status = $this->config['allow_post_links'] ? true : false; $flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false; $quote_status = true; // Build custom bbcodes array if ($bbcode_status) { display_custom_bbcodes(); } // Generate smiley listing if ($smilies_status) { generate_smilies('inline', $forum_id); } // Show attachment box for adding attachments if true $form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$this->config['allow_attachments'] || !$this->auth->acl_get('u_attach') || !$this->auth->acl_get('f_attach', $forum_id) ? '' : '" enctype="multipart/form-data'; $allowed = $this->auth->acl_get('f_attach', $forum_id) && $this->auth->acl_get('u_attach') && $this->config['allow_attachments'] && $form_enctype; $attachment_data = false; if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $allowed) { $this->user->add_lang('posting'); } if ($this->config['qr_attach'] && $allowed) { $this->template->assign_vars(array('U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}") . $form_enctype)); include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext; $message_parser = new \parse_message(); $message_parser->set_plupload($this->plupload); $message_parser->set_mimetype_guesser($this->mimetype_guesser); $message_parser->get_submitted_attachment_data($this->user->data['user_id']); $attachment_data = $message_parser->attachment_data; $filename_data = $message_parser->filename_data; posting_gen_inline_attachments($attachment_data); $max_files = $this->auth->acl_get('a_') || $this->auth->acl_get('m_', $forum_id) ? 0 : (int) $this->config['max_attachments']; $topic_id = $topic_data['topic_id']; $s_action = append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"); $this->plupload->configure($this->cache, $this->template, $s_action, $forum_id, $max_files); posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); } $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list)))); if ($this->phpbb_extension_manager->is_enabled('rxu/PostsMerging') && $this->user->data['is_registered'] && $this->config['merge_interval']) { // Always show the checkbox if PostsMerging extension is installed. $this->user->add_lang_ext('rxu/PostsMerging', 'posts_merging'); $this->template->assign_var('POSTS_MERGING_OPTION', true); } $this->template->assign_vars(array('S_QR_COLOUR_NICKNAME' => $this->config['qr_color_nickname'], 'S_QR_NOT_CHANGE_SUBJECT' => $this->auth->acl_get('f_qr_change_subject', $forum_id) ? false : true, 'S_QR_COMMA_ENABLE' => $this->config['qr_comma'], 'S_QR_QUICKNICK_ENABLE' => $this->config['qr_quicknick'], 'S_QR_QUICKNICK_REF' => $this->config['qr_quicknick_ref'], 'S_QR_QUICKNICK_PM' => $this->config['qr_quicknick_pm'], 'S_QR_QUICKQUOTE_ENABLE' => $this->config['qr_quickquote'], 'S_QR_QUICKQUOTE_LINK' => $this->config['qr_quickquote_link'], 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote'], 'S_QR_CE_ENABLE' => $this->config['qr_ctrlenter'], 'QR_SOURCE_POST' => $this->config['qr_source_post'], 'S_DISPLAY_USERNAME' => !$this->user->data['is_registered'], 'S_BBCODE_ALLOWED' => $bbcode_status ? 1 : 0, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_BBCODE_IMG' => $img_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'MESSAGE' => $this->request->variable('message', '', true), 'READ_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'S_QR_CAPS_ENABLE' => $this->config['qr_capslock_transfer'], 'S_QR_SHOW_BUTTON_TRANSLIT' => $this->config['qr_show_button_translit'], 'L_FULL_EDITOR' => $this->config['qr_ajax_submit'] ? $this->user->lang['PREVIEW'] : $this->user->lang['FULL_EDITOR'], 'S_QR_AJAX_SUBMIT' => $this->config['qr_ajax_submit'], 'S_QR_AJAX_PAGINATION' => $this->config['qr_ajax_pagination'] && $this->user->data['ajax_pagination'], 'S_QR_ENABLE_SCROLL' => $this->user->data['qr_enable_scroll'], 'S_QR_SCROLL_INTERVAL' => $this->config['qr_scroll_time'], 'S_QR_SOFT_SCROLL' => $this->config['qr_scroll_time'] && $this->user->data['qr_soft_scroll'], 'S_QR_ALLOWED_GUEST' => $this->config['qr_allow_for_guests'] && $this->user->data['user_id'] == ANONYMOUS, 'S_ABBC3_INSTALLED' => $this->phpbb_extension_manager->is_enabled('vse/abbc3'), 'S_QR_SHOW_ATTACH_BOX' => $this->config['qr_attach'] && $allowed, 'S_ATTACH_DATA' => $attachment_data ? json_encode($attachment_data) : '[]')); $add_re = $this->config['qr_enable_re'] ? 'Re: ' : ''; $this->template->assign_var('SUBJECT', $this->request->variable('subject', $add_re . censor_text($topic_data['topic_title']), true)); } $this->template->assign_vars(array('QR_HIDE_POSTS_SUBJECT' => $this->config['qr_show_subjects'] ? false : true)); }
/** * Initialize captcha instance * * @param bool $set_hidden_fields Whether we need to assign hidden fields to the template */ public function set_captcha($set_hidden_fields = true) { $captcha = $this->captcha->get_instance($this->config['captcha_plugin']); $captcha->init(CONFIRM_POST); if ($captcha->is_solved() === false) { $this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template())); } // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview if ($set_hidden_fields && $captcha->is_solved() !== false) { $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields())); } }
/** * Display add form * * @param int $cat_id The category ID * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object * @throws \phpbb\exception\http_exception */ public function new_link($cat_id) { if (!$this->auth->acl_get('u_submit_dir')) { throw new \phpbb\exception\http_exception(403, 'DIR_ERROR_NOT_AUTH'); } $cat_id = $this->request->variable('id', $cat_id); $submit = $this->request->is_set_post('submit') ? true : false; $refresh = $this->request->is_set_post('refresh_vc') ? true : false; $title = $this->user->lang['DIR_NEW_SITE']; $this->template->assign_block_vars('dir_navlinks', array('FORUM_NAME' => $title, 'U_VIEW_FORUM' => $this->helper->route('ernadoo_phpbbdirectory_new_controller', array('cat_id' => (int) $cat_id)))); $this->categorie->get($cat_id); // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. if (!$this->user->data['is_registered'] && $this->config['dir_visual_confirm']) { $this->captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']); $this->captcha->init(CONFIRM_POST); } // If form is done if ($submit || $refresh) { if (false != ($result = $this->_data_processing($cat_id))) { return $result; } } $this->_populate_form($cat_id, 'new', $title); return $this->helper->render('add_site.html', $title); }
/** * Constructor * * @param \phpbb\db\driver\driver_interface $db Database object * @param \phpbb\config\config $config Config object * @param \phpbb\template\template $template Template object * @param \phpbb\user $user User object * @param \phpbb\controller\helper $helper Controller helper object * @param \phpbb\request\request $request Request object * @param \phpbb\auth\auth $auth Auth object * @param \phpbb\pagination $pagination Pagination object * @param \phpbb\captcha\factory $captcha_factory Captcha object * @param \ernadoo\phpbbdirectory\core\categorie $categorie PhpBB Directory extension categorie object * @param \ernadoo\phpbbdirectory\core\comment $comment PhpBB Directory extension comment object * @param string $root_path phpBB root path * @param string $php_ext phpEx */ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\request\request $request, \phpbb\auth\auth $auth, \phpbb\pagination $pagination, \phpbb\captcha\factory $captcha_factory, \ernadoo\phpbbdirectory\core\categorie $categorie, \ernadoo\phpbbdirectory\core\comment $comment, $root_path, $php_ext) { $this->db = $db; $this->config = $config; $this->template = $template; $this->user = $user; $this->helper = $helper; $this->request = $request; $this->auth = $auth; $this->pagination = $pagination; $this->captcha_factory = $captcha_factory; $this->categorie = $categorie; $this->comment = $comment; $this->root_path = $root_path; $this->php_ext = $php_ext; $this->user->add_lang_ext('ernadoo/phpbbdirectory', 'directory'); $user->add_lang(array('ucp', 'posting')); $this->template->assign_vars(array('S_PHPBB_DIRECTORY' => true, 'DIRECTORY_TRANSLATION_INFO' => !empty($user->lang['DIRECTORY_TRANSLATION_INFO']) ? $user->lang['DIRECTORY_TRANSLATION_INFO'] : '', 'S_SIMPLE_MESSAGE' => true)); // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. if (!$this->user->data['is_registered'] && $this->config['dir_visual_confirm']) { $this->captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']); $this->captcha->init(CONFIRM_POST); } }
/** * Constructor * * @param \phpbb\config\config $config * @param request_interface $request * @param \phpbb\user $user * @param \phpbb\template\template $template * @param \phpbb\captcha\factory $captcha_factory * @param \phpbb\titania\attachment\uploader $uploader * @param access $access * @param string $phpbb_root_path * @param string $php_ext */ public function __construct(\phpbb\config\config $config, request_interface $request, \phpbb\user $user, \phpbb\template\template $template, \phpbb\captcha\factory $captcha_factory, \phpbb\titania\attachment\uploader $uploader, access $access, $phpbb_root_path, $php_ext) { $this->config = $config; $this->request = $request; $this->user = $user; $this->template = $template; $this->captcha = $captcha_factory->get_instance($this->config['captcha_plugin']); $this->uploader = $uploader; $this->access = $access; $this->options = new options($this->config, $this->user, $this->template); $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->user->add_lang_ext('phpbb/titania', 'posting'); $this->user->add_lang('posting'); }