/** * When an attachment fails to upload, this template will show * all the issues to the user */ function template_attachment_errors() { global $context, $txt; echo ' <div> <h2 class="category_header">', $txt['attach_error_title'], '</h2> <div class="windowbg">'; foreach ($context['attachment_error_keys'] as $key) { template_show_error($key); } echo ' </div> </div>'; }
} if ($voting_areas->code == MAPIT_BAD_POSTCODE) { $error_message = cobrand_bad_postcode_message($cobrand, $cocode); if (!$error_message) { $error_message = "Sorry, we need your complete UK postcode to identify your elected representatives."; } $template = "index-advice"; } else { if ($voting_areas->code == MAPIT_POSTCODE_NOT_FOUND) { $error_message = cobrand_postcode_not_found_message($cobrand, $cocode); if (!$error_message) { $error_message = "We’re not quite sure why, but we can’t seem to recognise your postcode."; } $template = "index-advice"; } else { template_show_error($voting_areas->text); } } } // Work out what representative types to show $title = ''; if ($cobrand) { $title = cobrand_step_title($cobrand, 1); } if ($title == '') { $title = "Email your Councillor, MP, MEP, MSP or Welsh, NI, or London Assembly Member for free"; } $blurb_top = '<h2 id="title">Write to your politicians, national or local, for free.</h2><p>Over 200,000 messages sent last year.</p>'; $fyr_all_url = null; $area_types = null; if ($a_forward) {
/** * The area above the post box, * Typically holds subject, preview, info messages, message icons, etc */ function template_postarea_above() { global $context, $scripturl, $txt, $modSettings; // Start the javascript... echo ' <script><!-- // --><![CDATA['; // When using Go Back due to fatal_error, allow the form to be re-submitted with changes. if (isBrowser('is_firefox')) { echo ' window.addEventListener("pageshow", reActivate, false);'; } // Start with message icons - and any missing from this theme. echo ' var icon_urls = {'; foreach ($context['icons'] as $icon) { echo ' \'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ','; } echo ' };'; // End of the javascript echo ' // ]]></script>'; // Start the form and display the link tree. echo ' <form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="UTF-8" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="', $context['becomes_approved'] ? '' : 'alert(\'' . $txt['js_post_will_require_approval'] . '\');', 'submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'', $context['post_box_name'], '\', \'guestname\', \'evtitle\', \'question\'], \'options\');revalidateMentions(\'postmodify\', \'', $context['post_box_name'], '\');" enctype="multipart/form-data">'; // If the user wants to see how their message looks - the preview section is where it's at! echo ' <div id="preview_section" class="forumposts"', isset($context['preview_message']) ? '' : ' style="display: none;"', '> <h3 class="category_header"> <span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span> </h3> <div class="post" id="preview_body"> ', empty($context['preview_message']) ? '<br />' : $context['preview_message'], ' </div> </div>'; // Start the main table. echo ' <div class="forumposts">', isset($context['current_topic']) ? '<input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '', ' <h3 class="category_header">', $context['page_title'], '</h3> <div class="windowbg"> <div class="editor_wrapper">'; // If an error occurred, explain what happened. template_show_error('post_error'); if (!empty($context['attachment_error_keys'])) { template_attachment_errors(); } // If this won't be approved let them know! // @todo why not use the template_show_error above? if (!$context['becomes_approved']) { echo ' <div class="successbox"> ', $txt['wait_for_approval'], ' <input type="hidden" name="not_approved" value="1" /> </div>'; } // If it's locked, show a message to warn the replyer. // @todo why not output it only for locked topics and why not use the template_show_error above? echo ' <p class="information"', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning"> ', $txt['topic_locked_no_reply'], ' </p>'; if (!empty($context['drafts_autosave'])) { echo ' <div id="draft_section" class="successbox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '> ', sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), ' </div>'; } // The post header... important stuff echo ' <dl id="post_header">'; // Guests have to put in their name and email... if (isset($context['name']) && isset($context['email'])) { echo ' <dt> <label for="guestname"', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? ' class="error"' : '', ' id="caption_guestname">', $txt['name'], ':</label> </dt> <dd> <input type="text" id="guestname" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text" required="required" /> </dd>'; if (empty($modSettings['guest_post_no_email'])) { echo ' <dt> <label for="email"', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' class="error"' : '', ' id="caption_email">', $txt['email'], ':</label> </dt> <dd> <input type="email" id="email" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" required="required" /> </dd>'; } } // Now show the subject box for this post. echo ' <dt class="clear"> <label for="post_subject"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</label> </dt> <dd> <input id="post_subject" type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', ' placeholder="', $txt['subject'], '" required="required" /> </dd> <dt class="clear_left"> <label for="icon">', $txt['message_icon'], '</label>: </dt> <dd> <select name="icon" id="icon" onchange="showimage()">'; // Loop through each message icon allowed, adding it to the drop down list. foreach ($context['icons'] as $icon) { echo ' <option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>'; } echo ' </select> <img src="', $context['icon_url'], '" id="icons" alt="" /> </dd>'; if (!empty($context['show_boards_dropdown'])) { echo ' <dt class="clear_left"> <label for="post_in_board">', $txt['post_in_board'], '</label>: </dt> <dd>', template_select_boards('post_in_board'), ' </dd>'; } echo ' </dl>'; }
exit; } foreach ($area_reps as $rep) { $oldname = $reps_info[$rep]['name']; $oldparty = $reps_info[$rep]['party']; $newname = $fyr_names[$rep]; $newparty = $fyr_parties[$rep]; if ($oldname != $newname || $oldparty != $newparty) { $ret = dadem_store_user_correction($fyr_vatype, $rep, 'modify', $newname, $newparty, $fyr_notes, $fyr_email); dadem_check_error($ret); } } if (isset($fyr_new['name']) && $fyr_new['name'] || $fyr_new['party'] && isset($fyr_new['party'])) { $ret = dadem_store_user_correction($fyr_vatype, null, 'add', $fyr_new['name'], $fyr_new['party'], $fyr_notes, $fyr_email); dadem_check_error($ret); } foreach ($fyr_delete as $rep_id => $dummy) { if (!in_array($rep_id, $area_reps)) { template_show_error('Trying to delete a rep not in this area?'); exit; } if (sizeof($area_reps) == 1) { template_show_error('Trying to delete the only representative?'); exit; } $ret = dadem_store_user_correction($fyr_vatype, $rep_id, 'delete', '', '', $fyr_notes, $fyr_email); dadem_check_error($ret); } $template_page = 'corrections-thanks'; } template_draw($template_page, array('id' => $fyr_vatype, 'va_info' => $va_info, 'reps_info' => $reps_info, 'parent_info' => $parent_info));
function check_area_status($eb_area, $fyr_voting_area) { global $cobrand; $parent_status = dadem_get_area_status($eb_area['id']); dadem_check_error($parent_status); $status = dadem_get_area_status($fyr_voting_area['id']); dadem_check_error($status); if ($parent_status != 'none' || $status != 'none') { $election_error = cobrand_election_error_message($cobrand); if (!$election_error) { $election_error = 'Sorry, an election is forthcoming or has recently happened here.'; } template_show_error($election_error); } }
/** * @package SimplePortal ElkArte * * @author SimplePortal Team * @copyright 2015 SimplePortal Team * @license BSD 3-clause * @version 1.0.0 Beta 1 */ function template_pages_edit() { global $context, $scripturl, $txt; // Previewing the page before submitting? echo ' <div id="preview_section" class="forumposts"', !empty($context['SPortal']['preview']) ? '' : ' style="display: none;"', '>', !empty($context['SPortal']['preview']) ? template_view_page() : '', ' </div>'; // If there were errors creating the page, show them. template_show_error('pages_errors'); // Adding or editing a page echo ' <div id="sp_edit_page"> <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=portalpages;sa=edit" method="post" accept-charset="UTF-8" onsubmit="submitonce(this);"> <h3 class="category_header"> ', $context['SPortal']['is_new'] ? $txt['sp_admin_pages_add'] : $txt['sp_admin_pages_edit'], ' </h3> <div class="editor_wrapper"> <dl class="sp_form"> <dt> <label for="page_title">', $txt['sp_admin_pages_col_title'], ':</label> </dt> <dd> <input type="text" name="title" id="page_title" value="', $context['SPortal']['page']['title'], '" class="input_text" /> </dd> <dt> <label for="page_namespace">', $txt['sp_admin_pages_col_namespace'], ':</label> </dt> <dd> <input type="text" name="namespace" id="page_namespace" value="', $context['SPortal']['page']['page_id'], '" class="input_text" /> </dd> <dt> <label for="page_type">', $txt['sp_admin_pages_col_type'], ':</label> </dt> <dd> <select name="type" id="page_type">'; $content_types = array('bbc', 'html', 'php'); foreach ($content_types as $type) { echo ' <option value="', $type, '"', $context['SPortal']['page']['type'] == $type ? ' selected="selected"' : '', '>', $txt['sp_pages_type_' . $type], '</option>'; } echo ' </select> </dd> <dt> <label for="page_permissions">', $txt['sp_admin_pages_col_permissions'], ':</label> </dt> <dd> <select name="permissions" id="page_permissions">'; foreach ($context['SPortal']['page']['permission_profiles'] as $profile) { echo ' <option value="', $profile['id'], '"', $profile['id'] == $context['SPortal']['page']['permissions'] ? ' selected="selected"' : '', '>', $profile['label'], '</option>'; } echo ' </select> </dd> <dt> <label for="page_blocks">', $txt['sp_admin_pages_col_blocks'], ':</label> </dt> <dd> <select name="blocks[]" id="page_blocks" size="7" multiple="multiple">'; foreach ($context['sides'] as $side => $label) { if (empty($context['page_blocks'][$side])) { continue; } echo ' <optgroup label="', $label, '">'; foreach ($context['page_blocks'][$side] as $block) { echo ' <option value="', $block['id'], '"', $block['shown'] ? ' selected="selected"' : '', '>', $block['label'], '</option>'; } echo ' </optgroup>'; } echo ' </select> </dd> <dt> <label for="page_status">', $txt['sp_admin_pages_col_status'], ':</label> </dt> <dd> <input type="checkbox" name="status" id="page_status" value="1"', $context['SPortal']['page']['status'] ? ' checked="checked"' : '', ' class="input_check" /> </dd> <dt> ', $txt['sp_admin_pages_col_body'], ': </dt> <dd> </dd> </dl> <div>', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '</div> <input type="submit" name="submit" value="', $context['page_title'], '" class="right_submit" /> <input type="submit" name="preview" value="', $txt['sp_admin_pages_preview'], '" class="right_submit" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> </div>'; $style_sections = array('title' => 'left', 'body' => 'right'); $style_types = array('default' => 'DefaultClass', 'class' => 'CustomClass', 'style' => 'CustomStyle'); $style_parameters = array('title' => array('category_header', 'secondary_header'), 'body' => array('content', 'information', 'roundframe')); echo ' <br /> <h3 class="category_header"> ', $txt['sp_admin_pages_style'], ' </h3> <div class="sp_content_padding">'; foreach ($style_sections as $section => $float) { echo ' <dl id="sp_edit_style_', $section, '" class="sp_form sp_float_', $float, '">'; foreach ($style_types as $type => $label) { echo ' <dt> ', $txt['sp-blocks' . ucfirst($section) . $label], ': </dt> <dd>'; if ($type == 'default') { echo ' <select name="', $section, '_default_class" id="', $section, '_default_class">'; foreach ($style_parameters[$section] as $class) { echo ' <option value="', $class, '"', $context['SPortal']['page']['style'][$section . '_default_class'] == $class ? ' selected="selected"' : '', '>', $class, '</option>'; } echo ' </select>'; } else { echo ' <input type="text" name="', $section, '_custom_', $type, '" id="', $section, '_custom_', $type, '" value="', $context['SPortal']['page']['style'][$section . '_custom_' . $type], '" class="input_text" />'; } echo ' </dd>'; } echo ' <dt> ', $txt['sp-blocksNo' . ucfirst($section)], ': </dt> <dd> <input type="checkbox" name="no_', $section, '" id="no_', $section, '" value="1"', !empty($context['SPortal']['page']['style']['no_' . $section]) ? ' checked="checked"' : '', ' onclick="check_style_options();" class="input_check" /> </dd> </dl>'; } echo ' <input type="submit" name="submit" value="', $context['page_title'], '" class="right_submit" /> <input type="submit" name="preview" value="', $txt['sp_admin_pages_preview'], '" class="right_submit" /> </div> <input type="hidden" name="page_id" value="', $context['SPortal']['page']['id'], '" /> </form> </div>'; addInlineJavascript('sp_editor_change_type("page_type");', true); }
/** * The report sub template gets shown from: * '?action=reporttm;topic=##.##;msg=##' * It should submit to: * '?action=reporttm;topic=' . $context['current_topic'] . '.' . $context['start'] * * It only needs to send the following fields: * comment: an additional comment to give the moderator. * sc: the session id, or $context['session_id']. */ function template_report() { global $context, $txt, $scripturl; echo ' <div id="report_topic"> <form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="UTF-8"> <input type="hidden" name="msg" value="' . $context['message_id'] . '" /> <h2 class="category_header">', $txt['report_to_mod'], '</h2> <div class="windowbg"> <div class="content">'; template_show_error('report_error'); echo ' <p class="warningbox">', $txt['report_to_mod_func'], '</p> <br /> <dl class="settings" id="report_post">'; if ($context['user']['is_guest']) { echo ' <dt> <label for="email_address">', $txt['email'], '</label>: </dt> <dd> <input type="text" id="email_address" name="email" value="', $context['email_address'], '" size="25" maxlength="255" /> </dd>'; } echo ' <dt> <label for="report_comment">', $txt['enter_comment'], '</label>: </dt> <dd> <textarea id="report_comment" name="comment">', $context['comment_body'], '</textarea> </dd>'; if ($context['require_verification']) { template_verification_controls($context['visual_verification_id'], ' <dt> ' . $txt['verification'] . ': </dt> <dd> ', ' </dd>'); } echo ' </dl> <div class="submitbutton"> <input type="submit" name="save" value="', $txt['rtm10'], '" class="button_submit" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> </div> </div> </div> </form> </div>'; }
/** * Template for the topic maintenance tasks. */ function template_maintain_topics() { global $scripturl, $txt, $context, $settings, $modSettings; // If maintenance has finished tell the user. template_show_error('maintenance_finished'); // Bit of javascript for showing which boards to prune in an otherwise hidden list. echo ' <script><!-- // --><![CDATA[ var rotSwap = false; maintain_old_choose = ', JavaScriptEscape($txt['maintain_old_choose']), ', maintain_old_all = ', JavaScriptEscape($txt['maintain_old_all']), '; // ]]></script>'; echo ' <div id="manage_maintenance"> <h2 class="category_header">', $txt['maintain_old'], '</h2> <div class="windowbg"> <div class="content flow_auto"> <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=pruneold" method="post" accept-charset="UTF-8">'; // The otherwise hidden "choose which boards to prune". echo ' <p> <a id="rotLink"></a><label for="maxdays">', sprintf($txt['maintain_old_since_days'], '<input type="text" id="maxdays" name="maxdays" value="30" size="3" />'), '</label> </p> <p> <label for="delete_type_nothing"><input type="radio" name="delete_type" id="delete_type_nothing" value="nothing" class="input_radio" /> ', $txt['maintain_old_nothing_else'], '</label><br /> <label for="delete_type_moved"><input type="radio" name="delete_type" id="delete_type_moved" value="moved" class="input_radio" checked="checked" /> ', $txt['maintain_old_are_moved'], '</label><br /> <label for="delete_type_locked"><input type="radio" name="delete_type" id="delete_type_locked" value="locked" class="input_radio" /> ', $txt['maintain_old_are_locked'], '</label><br /> </p>'; if (!empty($modSettings['enableStickyTopics'])) { echo ' <p> <label for="delete_old_not_sticky"><input type="checkbox" name="delete_old_not_sticky" id="delete_old_not_sticky" class="input_check" checked="checked" /> ', $txt['maintain_old_are_not_stickied'], '</label><br /> </p>'; } echo ' <p> <a href="#rotLink" onclick="swapRot();"><img src="', $settings['images_url'], '/selected.png" alt="+" id="rotIcon" /></a> <a href="#rotLink" onclick="swapRot();" id="rotText">', $txt['maintain_old_all'], '</a> </p> <div style="display: none;" id="rotPanel" class="flow_hidden"> <div class="floatleft grid50">'; // This is the "middle" of the list. $middle = ceil(count($context['categories']) / 2); $i = 0; foreach ($context['categories'] as $category) { echo ' <fieldset> <legend>', $category['name'], '</legend> <ul>'; // Display a checkbox with every board. foreach ($category['boards'] as $board) { echo ' <li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;"> <label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked="checked" class="input_check" />', $board['name'], '</label> </li>'; } echo ' </ul> </fieldset>'; // Increase $i, and check if we're at the middle yet. if (++$i == $middle) { echo ' </div> <div class="floatright grid50">'; } } echo ' </div> </div> <div class="submitbutton"> <input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_confirm'], '\');" class="button_submit" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" /> </div> </form> </div> </div> <h3 class="category_header">', $txt['maintain_old_drafts'], '</h3> <div class="windowbg"> <div class="content"> <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=olddrafts" method="post" accept-charset="UTF-8"> <p> <label for="draftdays">', sprintf($txt['maintain_old_drafts_days'], ' <input type="text" id="draftdays" name="draftdays" value="' . (!empty($modSettings['drafts_keep_days']) ? $modSettings['drafts_keep_days'] : 30) . '" size="3" /> '), '</label> </p> <div class="submitbutton"> <input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_drafts_confirm'], '\');" class="button_submit" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" /> </div> </form> </div> </div> <h3 class="category_header">', $txt['move_topics_maintenance'], '</h3> <div class="windowbg"> <div class="content"> <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=massmove" method="post" accept-charset="UTF-8"> <p>'; template_select_boards('id_board_from', $txt['move_topics_from']); template_select_boards('id_board_to', $txt['move_topics_to']); echo ' </p> <div class="submitbutton"> <input type="submit" value="', $txt['move_topics_now'], '" onclick="return confirmMoveTopics(', JavaScriptEscape($txt['move_topics_confirm']), ');" class="button_submit" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" /> </div> </form> </div> </div> </div>'; }
if (rabx_is_error($result)) { if ($result->code == FYR_QUEUE_MESSAGE_EXPIRED) { $url = cobrand_url($cobrand, "/", $cocode); $text = <<<EOF You took so long to confirm your message that under our privacy policy your message has already been removed from our database. If you’d still like to write a message, you can <a href="{$url}">try again from the beginning EOF; template_show_error($text); } else { template_show_error($result->text); } } if (!$result) { template_draw("confirm-trouble", $template_params); } else { $values = msg_admin_get_message($result); if (rabx_is_error($values)) { template_show_error($values->text); } elseif ($values['cobrand'] && cobrand_post_letter_send($values)) { // Do nothing - cobrand_post_letter_send must do the special action e.g. header or template_draw etc. } else { $values['cobrand'] = $cobrand; $values['host'] = fyr_get_host(); template_draw("confirm-accept", $values); } } ?>
require_once "../phplib/queue.php"; require_once "../commonlib/phplib/utility.php"; require_once "../commonlib/phplib/survey.php"; fyr_rate_limit(array()); $token = get_http_var('token'); if (!$token) { template_show_error("The token was missing."); } $answer = get_http_var('answer'); if ($answer != "yes" && $answer != "no") { template_show_error("The answer type was missing."); } // 1 is the firsttime question $result = msg_record_questionnaire_answer($token, 1, $answer); if (rabx_is_error($result)) { template_show_error($result->text); } $values = msg_admin_get_message($result); $values['cobrand'] = $cobrand; // Demographic survey list($values['user_code'], $values['auth_signature']) = survey_sign_email_address($values['sender_email']); $done_survey = survey_check_if_already_done($values['user_code'], $values['auth_signature']); //$rand = rand(0, 4); // high rate when want lots of data $rand = rand(0, 29); // low rate when not actively doing research, so still get 50-100 responses a month if (!$done_survey && $rand == 0 && cobrand_display_survey($cobrand)) { $values['return_url'] = OPTION_BASE_URL . htmlspecialchars($_SERVER['REQUEST_URI']); template_draw("survey-questions", $values); } else { // Either the questionnaire or the survey done template_draw("survey-done", $values);
function category_lookup($cat) { if ($cat == 'good') return ''; elseif ($cat == 'shame') return "MP doesn't accept messages via WriteToThem"; elseif ($cat == 'toofew') return 'Too few messages sent to MP'; elseif ($cat == 'unknown') return 'We need to manually check this MP'; elseif ($cat == 'cheat') return 'MP attempted to improve their response rate by sending themselves messages'; elseif ($cat == 'badcontact') return 'WriteToThem had possibly bad contact details for this MP'; else template_show_error("Unknown MP categorisation '".htmlspecialchars($cat)."'"); return $cat; }
/** * Calls on template_show_error from index.template.php to show warnings * and security errors for admins */ function template_admin_warning_above() { global $context, $txt; if (!empty($context['security_controls_files'])) { $context['security_controls_files']['type'] = 'serious'; template_show_error('security_controls_files'); } if (!empty($context['security_controls_query'])) { $context['security_controls_query']['type'] = 'serious'; template_show_error('security_controls_query'); } if (!empty($context['security_controls_ban'])) { $context['security_controls_ban']['type'] = 'serious'; template_show_error('security_controls_ban'); } if (!empty($context['new_version_updates'])) { template_show_error('new_version_updates'); } // Any special notices to remind the admin about? if (!empty($context['warning_controls'])) { $context['warning_controls']['errors'] = $context['warning_controls']; $context['warning_controls']['title'] = $txt['admin_warning_title']; $context['warning_controls']['type'] = 'warning'; template_show_error('warning_controls'); } }
/** * Template to edit and add bans */ function template_ban_edit() { global $context, $scripturl, $txt, $modSettings, $settings; echo ' <div id="manage_bans"> <form id="admin_form_wrapper" action="', $context['form_url'], '" method="post" accept-charset="UTF-8" onsubmit="return confirmBan(this);"> <h2 class="category_header"> ', $context['ban']['is_new'] ? $txt['ban_add_new'] : $txt['ban_edit'] . ' \'' . $context['ban']['name'] . '\'', ' </h2>'; if ($context['ban']['is_new']) { echo ' <div class="information">', $txt['ban_add_notes'], '</div>'; } // If there were errors creating the ban, show them. template_show_error('ban_errors'); echo ' <div class="content"> <dl class="settings"> <dt id="ban_name_label"> <label for="ban_name">', $txt['ban_name'], '</label>: </dt> <dd> <input type="text" id="ban_name" name="ban_name" value="', $context['ban']['name'], '" size="45" maxlength="60" class="input_text" /> </dd>'; if (isset($context['ban']['reason'])) { echo ' <dt> <label for="reason">', $txt['ban_reason'], ':</label><br /> <span class="smalltext">', $txt['ban_reason_desc'], '</span> </dt> <dd> <textarea name="reason" id="reason" cols="40" rows="3" class="ban_text">', $context['ban']['reason'], '</textarea> </dd>'; } if (isset($context['ban']['notes'])) { echo ' <dt> <label for="ban_notes">', $txt['ban_notes'], ':</label><br /> <span class="smalltext">', $txt['ban_notes_desc'], '</span> </dt> <dd> <textarea name="notes" id="ban_notes" cols="40" rows="3" class="ban_text">', $context['ban']['notes'], '</textarea> </dd>'; } echo ' </dl> <fieldset class="ban_settings floatleft"> <legend> ', $txt['ban_expiration'], ' </legend> <input type="radio" name="expiration" value="never" id="never_expires" onclick="fUpdateStatus();"', $context['ban']['expiration']['status'] == 'never' ? ' checked="checked"' : '', ' class="input_radio" /> <label for="never_expires">', $txt['never'], '</label><br /> <input type="radio" name="expiration" value="one_day" id="expires_one_day" onclick="fUpdateStatus();"', $context['ban']['expiration']['status'] == 'one_day' ? ' checked="checked"' : '', ' class="input_radio" /> <label for="expires_one_day">', $txt['ban_will_expire_within'], '</label>: <input type="text" name="expire_date" id="expire_date" size="3" value="', $context['ban']['expiration']['days'], '" class="input_text" /> ', $txt['ban_days'], '<br /> <input type="radio" name="expiration" value="expired" id="already_expired" onclick="fUpdateStatus();"', $context['ban']['expiration']['status'] == 'expired' ? ' checked="checked"' : '', ' class="input_radio" /> <label for="already_expired">', $txt['ban_expired'], '</label> </fieldset> <fieldset class="ban_settings floatright"> <legend> ', $txt['ban_restriction'], ' </legend> <input type="radio" name="full_ban" id="full_ban" value="1" onclick="fUpdateStatus();"', $context['ban']['cannot']['access'] ? ' checked="checked"' : '', ' class="input_radio" /> <label for="full_ban">', $txt['ban_full_ban'], '</label><br /> <input type="radio" name="full_ban" id="partial_ban" value="0" onclick="fUpdateStatus();"', !$context['ban']['cannot']['access'] ? ' checked="checked"' : '', ' class="input_radio" /> <label for="partial_ban">', $txt['ban_partial_ban'], '</label><br /> <input type="checkbox" name="cannot_post" id="cannot_post" value="1"', $context['ban']['cannot']['post'] ? ' checked="checked"' : '', ' class="ban_restriction input_radio" /> <label for="cannot_post">', $txt['ban_cannot_post'], '</label><a href="', $scripturl, '?action=quickhelp;help=ban_cannot_post" onclick="return reqOverlayDiv(this.href);" class="help"> <img src="', $settings['images_url'], '/helptopics.png" class="icon" alt="', $txt['help'], '" /></a><br /> <input type="checkbox" name="cannot_register" id="cannot_register" value="1"', $context['ban']['cannot']['register'] ? ' checked="checked"' : '', ' class="ban_restriction input_radio" /> <label for="cannot_register">', $txt['ban_cannot_register'], '</label><br /> <input type="checkbox" name="cannot_login" id="cannot_login" value="1"', $context['ban']['cannot']['login'] ? ' checked="checked"' : '', ' class="ban_restriction input_radio" /> <label for="cannot_login">', $txt['ban_cannot_login'], '</label><br /> </fieldset> <br class="clear_right" />'; if (!empty($context['ban_suggestions'])) { echo ' <fieldset> <legend> <input type="checkbox" onclick="invertAll(this, this.form, \'ban_suggestion\');" class="input_check"> ', $txt['ban_triggers'], ' </legend> <dl class="settings"> <dt> <input type="checkbox" name="ban_suggestions[]" id="main_ip_check" value="main_ip" class="input_check" ', !empty($context['ban_suggestions']['main_ip']) ? 'checked="checked" ' : '', '/> <label for="main_ip_check">', $txt['ban_on_ip'], '</label> </dt> <dd> <input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="44" onfocus="document.getElementById(\'main_ip_check\').checked = true;" class="input_text" /> </dd>'; if (empty($modSettings['disableHostnameLookup'])) { echo ' <dt> <input type="checkbox" name="ban_suggestions[]" id="hostname_check" value="hostname" class="input_check" ', !empty($context['ban_suggestions']['hostname']) ? 'checked="checked" ' : '', '/> <label for="hostname_check">', $txt['ban_on_hostname'], '</label> </dt> <dd> <input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="44" onfocus="document.getElementById(\'hostname_check\').checked = true;" class="input_text" /> </dd>'; } echo ' <dt> <input type="checkbox" name="ban_suggestions[]" id="email_check" value="email" class="input_check" ', !empty($context['ban_suggestions']['email']) ? 'checked="checked" ' : '', '/> <label for="email_check">', $txt['ban_on_email'], '</label> </dt> <dd> <input type="text" name="email" value="', $context['ban_suggestions']['email'], '" size="44" onfocus="document.getElementById(\'email_check\').checked = true;" class="input_text" /> </dd> <dt> <input type="checkbox" name="ban_suggestions[]" id="user_check" value="user" class="input_check" ', !empty($context['ban_suggestions']['user']) || isset($context['ban']['from_user']) ? 'checked="checked" ' : '', '/> <label for="user_check">', $txt['ban_on_username'], '</label>: </dt> <dd> <input type="text" ', !empty($context['ban']['from_user']) ? 'readonly="readonly" value="' . $context['ban_suggestions']['member']['name'] . '"' : ' value="' . (isset($context['ban_suggestions']['member']['name']) ? $context['ban_suggestions']['member']['name'] : '') . '"', ' name="user" id="user" size="44" class="input_text" /> </dd> </dl>'; if (!empty($context['ban_suggestions']['other_ips'])) { foreach ($context['ban_suggestions']['other_ips'] as $key => $ban_ips) { if (!empty($ban_ips)) { echo ' <div>', $txt[$key], ':</div> <dl class="settings">'; $count = 0; foreach ($ban_ips as $ip) { echo ' <dt> <input type="checkbox" id="suggestions_', $key, '_', $count, '" name="ban_suggestions[', $key, '][]" ', !empty($context['ban_suggestions']['saved_triggers'][$key]) && in_array($ip, $context['ban_suggestions']['saved_triggers'][$key]) ? 'checked="checked" ' : '', 'value="', $ip, '" class="input_check" /> </dt> <dd> <label for="suggestions_', $key, '_', $count++, '">', $ip, '</label> </dd>'; } echo ' </dl>'; } } } echo ' </fieldset>'; } echo ' <div class="submitbutton"> <input type="submit" name="', $context['ban']['is_new'] ? 'add_ban' : 'modify_ban', '" value="', $context['ban']['is_new'] ? $txt['ban_add'] : $txt['ban_modify'], '" class="button_submit" /> <input type="hidden" name="old_expire" value="', $context['ban']['expiration']['days'], '" /> <input type="hidden" name="bg" value="', $context['ban']['id'], '" />', isset($context['ban']['from_user']) ? ' <input type="hidden" name="u" value="' . $context['ban_suggestions']['member']['id'] . '" />' : '', ' <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['admin-bet_token_var'], '" value="', $context['admin-bet_token'], '" /> </div> </div> </form>'; if (!$context['ban']['is_new'] && empty($context['ban_suggestions'])) { echo ' <br />'; template_show_list('ban_items'); } echo ' </div>'; // Auto suggest only needed for adding new bans, not editing if (!empty($context['use_autosuggest'])) { echo ' <script><!-- // --><![CDATA[ var oAddMemberSuggest = new smc_AutoSuggest({ sSelf: \'oAddMemberSuggest\', sSessionId: elk_session_id, sSessionVar: elk_session_var, sSuggestId: \'user\', sControlId: \'user\', sSearchType: \'member\', sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\', bItemList: false }); oAddMemberSuggest.registerCallback(\'onBeforeUpdate\', \'onUpdateName\'); // ]]></script>'; } }
/** * Show the send a new pm form, including the editor, preview section and load * drafts if enabled. */ function template_send() { global $context, $scripturl, $modSettings, $settings, $txt; // Show which messages were sent successfully and which failed. if (!empty($context['send_log'])) { echo ' <div class="forumposts"> <h3 class="category_header">', $txt['pm_send_report'], '</h3> <div class="windowbg"> <div class="content">'; if (!empty($context['send_log']['sent'])) { foreach ($context['send_log']['sent'] as $log_entry) { echo '<span class="error">', $log_entry, '</span><br />'; } } if (!empty($context['send_log']['failed'])) { foreach ($context['send_log']['failed'] as $log_entry) { echo '<span class="error">', $log_entry, '</span><br />'; } } echo ' </div> </div> </div>'; } // Show the preview of the personal message. echo ' <div id="preview_section" class="forumposts"', isset($context['preview_message']) ? '' : ' style="display: none;"', '> <h3 class="category_header"> <span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span> </h3> <div class="post" id="preview_body"> ', empty($context['preview_message']) ? '<br />' : $context['preview_message'], ' </div> </div>'; // Main message editing box. echo ' <form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="UTF-8" name="pmFolder" id="pmFolder" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'pmFolder\', [\'subject\', \'message\']);"> <div class="forumposts"> <h3 class="category_header hdicon cat_img_write"> ', $txt['new_message'], ' </h3>'; echo ' <div class="windowbg"> <div class="editor_wrapper">'; // If there were errors for sending the PM, show them. template_show_error('post_error'); if (!empty($modSettings['drafts_pm_enabled'])) { echo ' <div id="draft_section" class="successbox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' </div>'; } echo ' <dl id="post_header">'; // To and bcc. Include a button to search for members. echo ' <dt> <label for="to_control"', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' class="error"' : '', ' id="caption_to">', $txt['pm_to'], ':</label> </dt>'; // Autosuggest will be added by the javascript later on. echo ' <dd id="pm_to" class="clear_right"> <input type="text" name="to" id="to_control" value="', $context['to_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" />'; // A link to add BCC, only visible with javascript enabled. echo ' <span class="smalltext" id="bcc_link_container" style="display: none;"></span>'; // A div that'll contain the items found by the autosuggest. echo ' <div id="to_item_list_container"></div>'; echo ' </dd>'; // This BCC row will be hidden by default if javascript is enabled. echo ' <dt class="clear_left" id="bcc_div"> <label for="bcc_control"', isset($context['post_error']['no_to']) || isset($context['post_error']['bad_bcc']) ? ' class="error"' : '', ' id="caption_bbc">', $txt['pm_bcc'], ':</label> </dt> <dd id="bcc_div2"> <input type="text" name="bcc" id="bcc_control" value="', $context['bcc_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text" /> <div id="bcc_item_list_container"></div> </dd>'; // The subject of the PM. echo ' <dt class="clear_left"> <label for="subject"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</label> </dt> <dd id="pm_subject"> <input type="text" id="subject" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', ' placeholder="', $txt['subject'], '" required="required" /> </dd> </dl>'; // Show BBC buttons, smileys and textbox. echo ' ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'); // Require an image to be typed to save spamming? if ($context['require_verification']) { template_verification_controls($context['visual_verification_id'], ' <div class="post_verification"> <strong>' . $txt['pm_visual_verification_label'] . ':</strong> ', ' </div>'); } // Send, Preview, spellchecker buttons. echo ' <div id="post_confirm_buttons" class="submitbutton"> ', template_control_richedit_buttons($context['post_box_name']), ' </div> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" /> <input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" /> <input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" /> <input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" /> <input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />'; // If the admin enabled the pm drafts feature, show a draft selection box if (!empty($modSettings['drafts_enabled']) && !empty($context['drafts_pm_save']) && !empty($context['drafts'])) { echo ' <h3 id="postDraftOptionsHeader" class="category_header"> <span id="category_toggle"> <span id="postDraftExpand" class="', empty($context['minmax_preferences']['pmdraft']) ? 'collapse' : 'expand', '" style="display: none;" title="', $txt['hide'], '"></span> </span> <a href="#" id="postDraftExpandLink">', $txt['draft_load'], '</a> </h3> <div id="postDraftOptions" class="load_drafts padding"', empty($context['minmax_preferences']['pmdraft']) ? '' : ' style="display: none;"', '> <dl class="settings"> <dt><strong>', $txt['subject'], '</strong></dt> <dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; foreach ($context['drafts'] as $draft) { echo ' <dt>', $draft['link'], '</dt> <dd>', $draft['poster_time'], '</dd>'; } echo ' </dl> </div>'; } echo ' </div> </div> </div> </form>'; // The vars used to preview a personal message without loading a new page. echo ' <script><!-- // --><![CDATA[ var form_name = "pmFolder", preview_area = "pm", txt_preview_title = "', $txt['preview_title'], '", txt_preview_fetch = "', $txt['preview_fetch'], '";'; // Code for showing and hiding drafts if (!empty($context['drafts'])) { echo ' var oSwapDraftOptions = new elk_Toggle({ bToggleEnabled: true, bCurrentlyCollapsed: ', empty($context['minmax_preferences']['pmdraft']) ? 'false' : 'true', ', aSwappableContainers: [ \'postDraftOptions\', ], aSwapClasses: [ { sId: \'postDraftExpand\', classExpanded: \'collapse\', titleExpanded: ', JavaScriptEscape($txt['hide']), ', classCollapsed: \'expand\', titleCollapsed: ', JavaScriptEscape($txt['show']), ' } ], aSwapLinks: [ { sId: \'postDraftExpandLink\', msgExpanded: ', JavaScriptEscape($txt['draft_hide']), ', msgCollapsed: ', JavaScriptEscape($txt['draft_load']), ' } ], oThemeOptions: { bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ', sOptionName: \'minmax_preferences\', sSessionId: elk_session_id, sSessionVar: elk_session_var, sAdditionalVars: \';minmax_key=pmdraft\' }, });'; } echo ' // ]]></script>'; // Show the message you're replying to. if ($context['reply']) { echo ' <div class="forumposts"> <h3 class="category_header">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> <div class="windowbg2"> <div class="content"> <div class="clear"> <span class="smalltext floatright">', $txt['on'], ': ', $context['quoted_message']['time'], '</span> <strong>', $txt['from'], ': ', $context['quoted_message']['member']['name'], '</strong> </div> <hr /> ', $context['quoted_message']['body'], ' </div> </div> </div>'; } echo ' <script><!-- // --><![CDATA[ var oPersonalMessageSend = new elk_PersonalMessageSend({ sSelf: \'oPersonalMessageSend\', sSessionId: elk_session_id, sSessionVar: elk_session_var, sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\', sToControlId: \'to_control\', aToRecipients: ['; foreach ($context['recipients']['to'] as $i => $member) { echo ' { sItemId: ', JavaScriptEscape($member['id']), ', sItemName: ', JavaScriptEscape($member['name']), ' }', $i == count($context['recipients']['to']) - 1 ? '' : ','; } echo ' ], aBccRecipients: ['; foreach ($context['recipients']['bcc'] as $i => $member) { echo ' { sItemId: ', JavaScriptEscape($member['id']), ', sItemName: ', JavaScriptEscape($member['name']), ' }', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; } echo ' ], sBccControlId: \'bcc_control\', sBccDivId: \'bcc_div\', sBccDivId2: \'bcc_div2\', sBccLinkId: \'bcc_link\', sBccLinkContainerId: \'bcc_link_container\', bBccShowByDefault: ', empty($context['recipients']['bcc']) && empty($context['bcc_value']) ? 'false' : 'true', ', sShowBccLinkTemplate: ', JavaScriptEscape(' <a href="#" id="bcc_link">' . $txt['make_bcc'] . '</a> <a href="' . $scripturl . '?action=quickhelp;help=pm_bcc" onclick="return reqOverlayDiv(this.href);"><img class="icon" src="' . $settings['images_url'] . '/helptopics.png" alt="(?)" /></a>'), ' }); // ]]></script>'; }
/** * Interface to allow edit of a poll. */ function template_poll_edit() { global $context, $txt; // Some javascript for adding more options. echo ' <script><!-- // --><![CDATA[ var pollOptionNum = 0, pollTabIndex = null, pollOptionId = ', $context['last_choice_id'], ', txt_option = "', $txt['option'], '", form_name = \'postmodify\'; // ]]></script>'; if (!empty($context['form_url'])) { echo ' <div id="edit_poll"> <form action="', $context['form_url'], '" method="post" accept-charset="UTF-8" onsubmit="submitonce(this); smc_saveEntities(\'postmodify\', [\'question\'], \'options-\');" name="postmodify" id="postmodify"> <h2 class="category_header">', $context['page_title'], '</h2> <div> <div class="roundframe">'; } template_show_error('poll_error'); if (!empty($context['poll']['id'])) { echo ' <input type="hidden" name="poll" value="', $context['poll']['id'], '" />'; } echo ' <fieldset id="poll_main"> <legend>', $txt['poll_question_options'], '</legend> <label for="question"', isset($context['poll_error']['no_question']) ? ' class="error"' : '', '>', $txt['poll_question'], ':</label> <input type="text" id="question" name="question" value="', isset($context['poll']['question']) ? $context['poll']['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80" class="input_text" required="required" placeholder="', $txt['poll_question'], '" /> <ul class="poll_main">'; // Loop through all the choices and print them out. foreach ($context['choices'] as $choice) { echo ' <li> <label for="options-', $choice['id'], '" ', isset($context['poll_error']['poll_few']) ? ' class="error"' : '', '>', $txt['option'], ' ', $choice['number'], '</label>: <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255" class="input_text" />'; // Does this option have a vote count yet, or is it new? if (isset($choice['votes']) && $choice['votes'] != -1) { echo ' (', $choice['votes'], ' ', $txt['votes'], ')'; } echo ' </li>'; } echo ' <li id="pollMoreOptions"></li> </ul> <strong><a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a></strong> </fieldset> <fieldset id="poll_options"> <legend>', $txt['poll_options'], ':</legend> <dl class="settings poll_options">'; if ($context['can_moderate_poll']) { echo ' <dt> <label for="poll_max_votes">', $txt['poll_max_votes'], ':</label> </dt> <dd> <input type="text" name="poll_max_votes" id="poll_max_votes" size="2" value="', $context['poll']['max_votes'], '" class="input_text" /> </dd> <dt> <label for="poll_expire">', $txt['poll_run'], ':</label><br /> <em class="smalltext">', $txt['poll_run_limit'], '</em> </dt> <dd> <input type="text" name="poll_expire" id="poll_expire" size="2" value="', $context['poll']['expiration'], '" onchange="pollOptions();" maxlength="4" class="input_text" /> ', $txt['days_word'], ' </dd> <dt> <label for="poll_change_vote">', $txt['poll_do_change_vote'], ':</label> </dt> <dd> <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked="checked"' : '', ' class="input_check" /> </dd>'; if ($context['poll']['guest_vote_allowed']) { echo ' <dt> <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label> </dt> <dd> <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll']['guest_vote']) ? ' checked="checked"' : '', ' class="input_check" /> </dd>'; } } echo ' <dt> ', $txt['poll_results_visibility'], ': </dt> <dd> <label for="poll_results_anyone"> <input type="radio" name="poll_hide" id="poll_results_anyone" value="0"', $context['poll']['hide_results'] == 0 ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['poll_results_anyone'], ' </label><br /> <label for="poll_results_voted"> <input type="radio" name="poll_hide" id="poll_results_voted" value="1"', $context['poll']['hide_results'] == 1 ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['poll_results_voted'], ' </label><br /> <label for="poll_results_expire"> <input type="radio" name="poll_hide" id="poll_results_expire" value="2"', $context['poll']['hide_results'] == 2 ? ' checked="checked"' : '', empty($context['poll']['expiration']) ? ' disabled="disabled"' : '', ' class="input_radio" /> ', $txt['poll_results_after'], ' </label> </dd> </dl> </fieldset>'; // If this is an edit, we can allow them to reset the vote counts. // @todo a warning maybe while saving? if (!empty($context['is_edit'])) { echo ' <fieldset id="poll_reset"> <legend>', $txt['reset_votes'], '</legend> <input type="checkbox" id="resetVoteCount" name="resetVoteCount" value="on" class="input_check" /> <label for="resetVoteCount">' . $txt['reset_votes_check'] . '</label> </fieldset>'; } if (!empty($context['form_url'])) { echo ' <input type="submit" name="post" value="', $txt['save'], '" onclick="return submitThisOnce(this);" accesskey="s" class="right_submit" /> </div> </div> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" /> </form> </div>'; } }
template_show_error($missing_answer_message); } $yes_url = cobrand_url($cobrand, "/firsttime?token=" . urlencode($token) . "&answer=yes", $cocode); $no_url = cobrand_url($cobrand, "/firsttime?token=" . urlencode($token) . "&answer=no", $cocode); $values = array('first_time_yes' => "\"{$yes_url}\"", 'first_time_no' => "\"{$no_url}\"", 'cobrand' => $cobrand, 'cocode' => $cocode, 'host' => fyr_get_host()); // Look up info about the message $msg_id = msg_get_questionnaire_message($token); msg_check_error($msg_id); if (!$msg_id) { $unfound_token_message = cobrand_unfound_token_message($cobrand); if (!$unfound_token_message) { $unfound_token_message = "Failed to look up message id for token"; } template_show_error($unfound_token_message); } $msg_info = msg_admin_get_message($msg_id); msg_check_error($msg_info); $values = array_merge($msg_info, $values); // 0 is the responsiveness question $result = msg_record_questionnaire_answer($token, 0, $answer); msg_check_error($result); if ($answer == "yes") { template_draw("response-yes", $values); } elseif ($answer == "no") { template_draw("response-no", $values); } else { template_show_error("Unknown answer."); } ?>
function category_lookup($cat) { if ($cat == 'good') { return ''; } elseif ($cat == 'shame') { return "MP did not accept messages via WriteToThem"; } elseif ($cat == 'toofew') { return 'Too little data for valid analysis'; } elseif ($cat == 'unknown') { return 'We need to manually check this MP'; } elseif ($cat == 'cheat') { return '<a href="https://www.writetothem.com/about-ilg">MP attempted to improve their response rate by sending themselves messages</a>'; } elseif ($cat == 'badcontact') { return 'WriteToThem had possibly bad contact details for this MP'; } else { template_show_error("Unknown MP categorisation '" . htmlspecialchars($cat) . "'"); } return $cat; }
function fyr_rate_limit($important_vars) { // Disabled for now, as not used, and slowed things down making the Ratty call return; $important_vars['IPADDR'] = array($_SERVER['REMOTE_ADDR'], "IP address"); $important_vars['SERVER'] = array($_SERVER['SERVER_NAME'], "Web server"); $important_vars['PAGE'] = array($_SERVER['SCRIPT_NAME'], "Web page"); $ret = ratty_test("fyr-web", $important_vars); if (isset($ret)) { list($rule, $error_message, $title) = $ret; if ($error_message == "") { $error_message = "Sorry, we are experiencing technical difficulties. Please try again later."; } $error_message .= "\n<!-- ratty the rate limiter rule #{$rule} limit exceeded -->\n"; template_show_error($error_message); } }
function check_message_id($msgid) { /* Check that they've come back with a valid message ID. Really we should * be verifying all the data that we've retrieved from the browser with a * hash, but in this case it doesn't matter. */ if (!preg_match("/^[0-9a-f]{20}$/i", $msgid)) { template_show_error('Sorry, but your browser seems to be transmitting erroneous data to us. Please try again, or contact us at <a href="mailto:team@writetothem.com">team@writetothem.com</a>.'); } }
/** * Used to add or edit an article */ function template_articles_edit() { global $context, $scripturl, $txt; // Taking a peek before you publish? echo ' <div id="preview_section" class="forumposts"', !empty($context['preview']) ? '' : ' style="display: none;"', '>', !empty($context['preview']) ? template_view_article() : '', ' </div>'; // If there were errors creating the article, show them. template_show_error('article_errors'); echo ' <div id="sp_edit_article"> <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=portalarticles;sa=edit" method="post" accept-charset="UTF-8" onsubmit="submitonce(this);"> <h3 class="category_header"> ', $context['is_new'] ? $txt['sp_admin_articles_add'] : $txt['sp_admin_articles_edit'], ' </h3> <div class="content"> <dl class="sp_form"> <dt> <label for="article_title">', $txt['sp_admin_articles_col_title'], ':</label> </dt> <dd> <input type="text" name="title" id="article_title" value="', $context['article']['title'], '" class="input_text" /> </dd> <dt> <label for="article_namespace">', $txt['sp_admin_articles_col_namespace'], ':</label> </dt> <dd> <input type="text" name="namespace" id="article_namespace" value="', $context['article']['article_id'], '" class="input_text" /> </dd> <dt> <label for="article_category">', $txt['sp_admin_articles_col_category'], ':</label> </dt> <dd> <select name="category_id" id="article_category">'; foreach ($context['article']['categories'] as $category) { echo ' <option value="', $category['id'], '"', $context['article']['category']['id'] == $category['id'] ? ' selected="selected"' : '', '>', $category['name'], '</option>'; } echo ' </select> </dd> <dt> <label for="article_type">', $txt['sp_admin_articles_col_type'], ':</label> </dt> <dd> <select name="type" id="article_type">'; $content_types = array('bbc', 'html', 'php'); foreach ($content_types as $type) { echo ' <option value="', $type, '"', $context['article']['type'] == $type ? ' selected="selected"' : '', '>', $txt['sp_articles_type_' . $type], '</option>'; } echo ' </select> </dd> <dt> <label for="article_permissions">', $txt['sp_admin_articles_col_permissions'], ':</label> </dt> <dd> <select name="permissions" id="article_permissions" onchange="sp_update_permissions();">'; foreach ($context['article']['permission_profiles'] as $profile) { echo ' <option value="', $profile['id'], '"', $profile['id'] == $context['article']['permissions'] ? ' selected="selected"' : '', '>', $profile['label'], '</option>'; } echo ' </select> </dd> <dt> <label for="article_status">', $txt['sp_admin_articles_col_status'], ':</label> </dt> <dd> <input type="checkbox" name="status" id="article_status" value="1"', $context['article']['status'] ? ' checked="checked"' : '', ' class="input_check" /> </dd> </dl> <div id="sp_rich_editor">', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'), '</div> <div class="submitbutton"> <input type="submit" name="submit" value="', $context['page_title'], '" class="button_submit" /> <input type="submit" name="preview" value="', $txt['sp_admin_articles_preview'], '" class="button_submit" /> <input type="hidden" name="article_id" value="', $context['article']['id'], '" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> </div> </form> </div> </div>'; addInlineJavascript('sp_editor_change_type("article_type");', true); }