/** * The UI for recommending the site. * * @return tempcode The UI. */ function gui() { require_code('form_templates'); global $EXTRA_HEAD; $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />'); // XHTMLXHTML global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'page_title'; $NON_CANONICAL_PARAMS[] = 'subject'; $NON_CANONICAL_PARAMS[] = 's_message'; $NON_CANONICAL_PARAMS[] = 'from'; $NON_CANONICAL_PARAMS[] = 'title'; $NON_CANONICAL_PARAMS[] = 'ocp'; $page_title = get_param('page_title', NULL, true); $submit_name = !is_null($page_title) ? make_string_tempcode($page_title) : do_lang_tempcode('SEND'); $post_url = build_url(array('page' => '_SELF', 'type' => 'actual'), '_SELF', NULL, true); $hidden = new ocp_tempcode(); $name = post_param('name', is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_username(get_member())); $recommender_email_address = post_param('recommender_email_address', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member())); $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('YOUR_NAME'), '', 'name', $name, true)); $fields->attach(form_input_email(do_lang_tempcode('YOUR_EMAIL_ADDRESS'), '', 'recommender_email_address', $recommender_email_address, true)); $already = array(); foreach ($_POST as $key => $email_address) { if (substr($key, 0, 14) != 'email_address_') { continue; } if (get_magic_quotes_gpc()) { $email_address = stripslashes($email_address); } $already[] = $email_address; } if (is_guest()) { $fields->attach(form_input_email(do_lang_tempcode('FRIEND_EMAIL_ADDRESS'), '', 'email_address_0', array_key_exists(0, $already) ? $already[0] : '', true)); } else { $fields->attach(form_input_line_multi(do_lang_tempcode('FRIEND_EMAIL_ADDRESS'), do_lang_tempcode('THEIR_ADDRESS'), 'email_address_', $already, 1, NULL, 'email')); } if (may_use_invites() && get_forum_type() == 'ocf' && !is_guest()) { $invites = get_num_invites(get_member()); if ($invites > 0) { require_lang('ocf'); $invite = count($_POST) == 0 ? true : post_param_integer('invite', 0) == 1; $fields->attach(form_input_tick(do_lang_tempcode('USE_INVITE'), do_lang_tempcode('USE_INVITE_DESCRIPTION', $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member()) ? do_lang('NA_EM') : integer_format($invites)), 'invite', $invite)); } } $message = post_param('message', NULL); $subject = get_param('subject', do_lang('RECOMMEND_MEMBER_SUBJECT', get_site_name()), true); if (is_null($message)) { $message = get_param('s_message', '', true); if ($message == '') { $from = get_param('from', NULL, true); if (!is_null($from)) { $resource_title = get_param('title', '', true); if ($resource_title == '') { $downloaded_at_link = http_download_file($from, 3000, false); if (is_string($downloaded_at_link)) { $matches = array(); if (preg_match('#\\s*<title[^>]*\\s*>\\s*(.*)\\s*\\s*<\\s*/title\\s*>#mi', $downloaded_at_link, $matches) != 0) { $resource_title = trim(str_replace('–', '-', str_replace('—', '-', @html_entity_decode($matches[1], ENT_QUOTES, get_charset())))); $resource_title = preg_replace('#^' . str_replace('#', '\\#', preg_quote(get_site_name())) . ' - #', '', $resource_title); $resource_title = preg_replace('#\\s+[^\\d\\s][^\\d\\s]?[^\\d\\s]?\\s+' . str_replace('#', '\\#', preg_quote(get_site_name())) . '$#i', '', $resource_title); } } } if ($resource_title == '') { $resource_title = do_lang('THIS'); // Could not find at all, so say 'this' } else { $subject = get_param('subject', do_lang('RECOMMEND_MEMBER_SUBJECT_SPECIFIC', get_site_name(), $resource_title), true); } $message = do_lang('FOUND_THIS_ON', get_site_name(), comcode_escape($from), comcode_escape($resource_title)); } } if (get_param_integer('ocp', 0) == 1) { $message = do_lang('RECOMMEND_OCPORTAL'); } } $text = is_null($page_title) ? do_lang_tempcode('RECOMMEND_SITE_TEXT') : new ocp_tempcode(); if (!is_null(get_param('from', NULL, true))) { if (is_null($page_title)) { $title = get_page_title('RECOMMEND_LINK'); } else { $title = get_page_title($page_title, false); } $submit_name = do_lang_tempcode('SEND'); $text = do_lang_tempcode('RECOMMEND_AUTO_TEXT', get_site_name()); $need_message = true; } else { if (is_null($page_title)) { $title = get_page_title('_RECOMMEND_SITE', true, array(escape_html(get_site_name()))); } else { $title = get_page_title($page_title, false); } $hidden->attach(form_input_hidden('wrap_message', '1')); $need_message = false; } //add an upload CSV contacts file field $_help_url = build_url(array('page' => 'recommend_help'), get_page_zone('recommend_help')); $help_url = $_help_url->evaluate(); if (get_value('disable_csv_recommend') !== '1' && !is_guest()) { $fields->attach(form_input_upload(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('UPLOAD')), do_lang_tempcode('DESCRIPTION_UPLOAD_CSV_FILE', escape_html($help_url)), 'upload', false, NULL, NULL, false)); } handle_max_file_size($hidden); $fields->attach(form_input_line(do_lang_tempcode('SUBJECT'), '', 'subject', $subject, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('MESSAGE'), do_lang_tempcode('RECOMMEND_SUP_MESSAGE'), 'message', $message, $need_message)); if (addon_installed('captcha')) { require_code('captcha'); if (use_captcha()) { $fields->attach(form_input_captcha()); $text->attach(' '); $text->attach(do_lang_tempcode('FORM_TIME_SECURITY')); } } $hidden->attach(form_input_hidden('comcode__message', '1')); if (get_value('disable_csv_recommend') !== '1' && !is_guest()) { $javascript = 'standardAlternateFields(\'upload\',\'email_address_0\');'; } else { $javascript = ''; } $javascript .= function_exists('captcha_ajax_check') ? captcha_ajax_check() : ''; return do_template('FORM_SCREEN', array('_GUID' => '08a538ca8d78597b0417f464758a59fd', 'JAVASCRIPT' => $javascript, 'SKIP_VALIDATION' => true, 'TITLE' => $title, 'HIDDEN' => $hidden, 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => $submit_name, 'TEXT' => $text)); }
/** * The UI to report a post. * * @return tempcode The UI */ function report_post() { $post_id = get_param_integer('id'); $post_info = $GLOBALS['FORUM_DB']->query_select('f_posts', array('*'), array('id' => $post_id), '', 1); if (!array_key_exists(0, $post_info)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $topic_id = $post_info[0]['p_topic_id']; $topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('*'), array('id' => $topic_id), '', 1); if (!array_key_exists(0, $topic_info)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $this->handle_topic_breadcrumbs($topic_info[0]['t_forum_id'], $topic_id, $topic_info[0]['t_cache_first_title'], do_lang_tempcode('REPORT_POST')); $this->check_has_mod_access($topic_id); $poster = $post_info[0]['p_poster_name_if_guest']; $member = $poster; if (!is_guest($post_info[0]['p_poster'])) { $member = '[page type="view" id="' . strval($post_info[0]['p_poster']) . '" param="' . get_module_zone('members') . '" caption="' . $poster . '"]members[/page]'; } $_postdetails = post_param('post', NULL); if (is_null($_postdetails)) { $__post = get_translated_text($post_info[0]['p_post'], $GLOBALS['FORUM_DB']); $post = do_template('OCF_REPORTED_POST_FCOMCODE', array('_GUID' => 'e0f65423f3cb7698d5f04431dbe52ddb', 'POST_ID' => strval($post_id), 'MEMBER' => $member, 'TOPIC_TITLE' => $topic_info[0]['t_cache_first_title'], 'POST' => $__post, 'POSTER' => $poster)); } else { $post = make_string_tempcode($_postdetails); } $hidden_fields = new ocp_tempcode(); if (!is_guest()) { $options = array(); if (get_option('is_on_anonymous_posts') == '1') { $options[] = array(do_lang_tempcode('_MAKE_ANONYMOUS_POST'), 'anonymous', false, do_lang_tempcode('MAKE_ANONYMOUS_POST_DESCRIPTION')); } $specialisation = form_input_various_ticks($options, ''); } else { $specialisation = new ocp_tempcode(); } $hidden_fields->attach(form_input_hidden('forum_id', '-2')); $hidden_fields->attach(form_input_hidden('validated', '1')); $report_title = $post_info[0]['p_title']; if ($report_title == '') { $report_title = $topic_info[0]['t_cache_first_title']; } $hidden_fields->attach(form_input_hidden('title', do_lang('REPORTED_POST_TITLE', $report_title))); $hidden_fields->attach(form_input_hidden('o_post_id', strval($post_id))); $hidden_fields->attach(form_input_hidden('from_url', get_self_url(true))); $text = new ocp_tempcode(); if (addon_installed('captcha')) { require_code('captcha'); if (use_captcha()) { $specialisation->attach(form_input_captcha()); $text->attach(paragraph(do_lang_tempcode('FORM_TIME_SECURITY'))); } } if (addon_installed('points')) { $login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => get_self_url(true, true)), get_module_zone('login')); $_login_url = escape_html($login_url->evaluate()); if (is_guest() && (get_forum_type() != 'ocf' || has_actual_page_access(get_member(), 'join'))) { $text->attach(paragraph(do_lang_tempcode('NOT_LOGGED_IN_NO_CREDIT', $_login_url))); } } $post_url = build_url(array('page' => '_SELF', 'type' => '_add_reply'), '_SELF'); $posting_form = get_posting_form(do_lang('REPORT_POST'), $post->evaluate(), $post_url, $hidden_fields, $specialisation, NULL, '', NULL, NULL, $this->_post_javascript() . (function_exists('captcha_ajax_check') ? captcha_ajax_check() : ''), NULL, true, false); $title = get_page_title('REPORT_POST'); return do_template('POSTING_SCREEN', array('_GUID' => 'eee64757e66fed702f74fecf8d595260', 'TITLE' => $title, 'TEXT' => $text, 'POSTING_FORM' => $posting_form)); }
/** * The UI to contact a member. * * @return tempcode The UI */ function gui() { $member_id = get_param_integer('id'); $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id); if (is_null($username)) { warn_exit(do_lang_tempcode('USER_NO_EXIST')); } $title = get_page_title('EMAIL_MEMBER', true, array(escape_html($username))); global $EXTRA_HEAD; $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />'); // XHTMLXHTML $text = do_lang_tempcode('EMAIL_MEMBER_TEXT'); $fields = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_line(do_lang_tempcode('SUBJECT'), '', 'subject', get_param('subject', '', true), true)); $default_email = is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_email_address'); $default_name = is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_username'); $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('_DESCRIPTION_NAME'), 'name', $default_name, true)); $fields->attach(form_input_email(do_lang_tempcode('EMAIL_ADDRESS'), do_lang_tempcode('YOUR_ADDRESS'), 'email_address', $default_email, true)); $fields->attach(form_input_text(do_lang_tempcode('MESSAGE'), '', 'message', get_param('message', '', true), true)); if (addon_installed('captcha')) { require_code('captcha'); if (use_captcha()) { $fields->attach(form_input_captcha()); $text->attach(' '); $text->attach(do_lang_tempcode('FORM_TIME_SECURITY')); } } $size = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_max_email_attach_size_mb'); $hidden = new ocp_tempcode(); if ($size != 0) { handle_max_file_size($hidden); $fields->attach(form_input_upload_multi(do_lang_tempcode('_ATTACHMENT'), do_lang_tempcode('EMAIL_ATTACHMENTS', integer_format($size)), 'attachment', false)); } $submit_name = do_lang_tempcode('SEND'); $redirect = get_param('redirect', ''); if ($redirect == '') { $redirect = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true); if (is_object($redirect)) { $redirect = $redirect->evaluate(); } } $post_url = build_url(array('page' => '_SELF', 'type' => 'actual', 'id' => $member_id, 'redirect' => $redirect), '_SELF'); return do_template('FORM_SCREEN', array('_GUID' => 'e06557e6eceacf1f46ee930c99ac5bb5', 'TITLE' => $title, 'HIDDEN' => $hidden, 'JAVASCRIPT' => function_exists('captcha_ajax_check') ? captcha_ajax_check() : '', 'FIELDS' => $fields, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url)); }
function form() { $title = get_page_title('REPORT_CONTENT'); require_code('form_templates'); $url = get_param('url', false, true); $content_type = get_param('content_type'); // Equates to a content_meta_aware hook $content_id = get_param('content_id'); require_code('content'); if (!is_null($GLOBALS['SITE_DB']->query_value_null_ok('reported_content', 'r_counts', array('r_session_id' => get_session_id(), 'r_content_type' => $content_type, 'r_content_id' => $content_id)))) { warn_exit(do_lang_tempcode('ALREADY_REPORTED_CONTENT')); } list($content_title, $poster_id, ) = content_get_details($content_type, $content_id); if ($content_title == '') { $content_title = $content_type . ' #' . $content_id; } $poster = $GLOBALS['FORUM_DRIVER']->get_username($poster_id); // Show form with input field and CAPTCHA, like forum's report post... $member = $poster; if (!is_guest($poster_id)) { $member = '[page type="view" id="' . strval($poster_id) . '" param="' . get_module_zone('members') . '" caption="' . $poster . '"]members[/page]'; } $hidden_fields = build_keep_form_fields('', true); $text = paragraph(do_lang_tempcode('DESCRIPTION_REPORT_CONTENT', escape_html($content_title), escape_html(integer_format(intval(get_option('reported_times')))))); $specialisation = new ocp_tempcode(); if (!is_guest()) { $options = array(); if (get_option('is_on_anonymous_posts') == '1') { $options[] = array(do_lang_tempcode('_MAKE_ANONYMOUS_POST'), 'anonymous', false, do_lang_tempcode('MAKE_ANONYMOUS_POST_DESCRIPTION')); } $specialisation = form_input_various_ticks($options, ''); } else { $specialisation = new ocp_tempcode(); } if (addon_installed('captcha')) { require_code('captcha'); if (use_captcha()) { $specialisation->attach(form_input_captcha()); $text->attach(paragraph(do_lang_tempcode('FORM_TIME_SECURITY'))); } } if (addon_installed('points')) { $login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => get_self_url(true, true)), get_module_zone('login')); $_login_url = escape_html($login_url->evaluate()); if (is_guest() && (get_forum_type() != 'ocf' || has_actual_page_access(get_member(), 'join'))) { $text->attach(paragraph(do_lang_tempcode('NOT_LOGGED_IN_NO_CREDIT', $_login_url))); } } $post_url = build_url(array('page' => '_SELF', 'type' => 'actual'), '_SELF'); $post = do_template('REPORTED_CONTENT_FCOMCODE', array('URL' => $url, 'CONTENT_ID' => $content_id, 'MEMBER' => $member, 'CONTENT_TITLE' => $content_title, 'POSTER' => $poster)); $posting_form = get_posting_form(do_lang('REPORT_CONTENT'), $post->evaluate(), $post_url, $hidden_fields, $specialisation, NULL, '', NULL, NULL, NULL, NULL, true, false); return do_template('POSTING_SCREEN', array('TITLE' => $title, 'JAVASCRIPT' => function_exists('captcha_ajax_check') ? captcha_ajax_check() : '', 'TEXT' => $text, 'POSTING_FORM' => $posting_form)); }