123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <?php
- /**
- * Simple Machines Forum (SMF)
- *
- * @package SMF
- * @author Simple Machines
- * @copyright 2012 Simple Machines Forum contributors
- * @license http://www.simplemachines.org/about/smf/license.php BSD
- *
- * @version 2.1 Alpha 1
- */
- function template_modify_weights()
- {
- global $context, $settings, $options, $scripturl, $txt, $modSettings;
- echo '
- <div id="admincenter">
- <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=managesearch;sa=weights" method="post" accept-charset="', $context['character_set'], '">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['search_weights'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <dl class="settings">
- <dt class="large_caption">
- <a href="', $scripturl, '?action=helpadmin;help=search_weight_frequency" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight1_val">
- ', $txt['search_weight_frequency'], ':</label>
- </dt>
- <dd class="large_caption">
- <span class="search_weight"><input type="text" name="search_weight_frequency" id="weight1_val" value="', empty($modSettings['search_weight_frequency']) ? '0' : $modSettings['search_weight_frequency'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span>
- <span id="weight1" class="search_weight">', $context['relative_weights']['search_weight_frequency'], '%</span>
- </dd>
- <dt class="large_caption">
- <a href="', $scripturl, '?action=helpadmin;help=search_weight_age" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight2_val">
- ', $txt['search_weight_age'], ':</label>
- </dt>
- <dd class="large_caption">
- <span class="search_weight"><input type="text" name="search_weight_age" id="weight2_val" value="', empty($modSettings['search_weight_age']) ? '0' : $modSettings['search_weight_age'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span>
- <span id="weight2" class="search_weight">', $context['relative_weights']['search_weight_age'], '%</span>
- </dd>
- <dt class="large_caption">
- <a href="', $scripturl, '?action=helpadmin;help=search_weight_length" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight3_val">
- ', $txt['search_weight_length'], ':</label>
- </dt>
- <dd class="large_caption">
- <span class="search_weight"><input type="text" name="search_weight_length" id="weight3_val" value="', empty($modSettings['search_weight_length']) ? '0' : $modSettings['search_weight_length'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span>
- <span id="weight3" class="search_weight">', $context['relative_weights']['search_weight_length'], '%</span>
- </dd>
- <dt class="large_caption">
- <a href="', $scripturl, '?action=helpadmin;help=search_weight_subject" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight4_val">
- ', $txt['search_weight_subject'], ':</label>
- </dt>
- <dd class="large_caption">
- <span class="search_weight"><input type="text" name="search_weight_subject" id="weight4_val" value="', empty($modSettings['search_weight_subject']) ? '0' : $modSettings['search_weight_subject'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span>
- <span id="weight4" class="search_weight">', $context['relative_weights']['search_weight_subject'], '%</span>
- </dd>
- <dt class="large_caption">
- <a href="', $scripturl, '?action=helpadmin;help=search_weight_first_message" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight5_val">
- ', $txt['search_weight_first_message'], ':</label>
- </dt>
- <dd class="large_caption">
- <span class="search_weight"><input type="text" name="search_weight_first_message" id="weight5_val" value="', empty($modSettings['search_weight_first_message']) ? '0' : $modSettings['search_weight_first_message'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span>
- <span id="weight5" class="search_weight">', $context['relative_weights']['search_weight_first_message'], '%</span>
- </dd>
- <dt class="large_caption">
- <a href="', $scripturl, '?action=helpadmin;help=search_weight_frequency" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" align="top" /></a><label for="weight6_val">
- ', $txt['search_weight_sticky'], ':</label>
- </dt>
- <dd class="large_caption">
- <span class="search_weight"><input type="text" name="search_weight_sticky" id="weight6_val" value="', empty($modSettings['search_weight_sticky']) ? '0' : $modSettings['search_weight_sticky'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span>
- <span id="weight6" class="search_weight">', $context['relative_weights']['search_weight_sticky'], '%</span>
- </dd>
- <dt class="large_caption">
- <strong>', $txt['search_weights_total'], '</strong>
- </dt>
- <dd class="large_caption">
- <span id="weighttotal" class="search_weight"><strong>', $context['relative_weights']['total'], '</strong></span>
- <span class="search_weight"><strong>100%</strong></span>
- </dd>
- </dl>
- <input type="submit" name="save" value="', $txt['search_weights_save'], '" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- <input type="hidden" name="', $context['admin-msw_token_var'], '" value="', $context['admin-msw_token'], '" />
- </div>
- </div>
- </form>
- </div>';
- }
- function template_select_search_method()
- {
- global $context, $settings, $options, $scripturl, $txt, $modSettings;
- echo '
- <div id="admincenter">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['search_method'], '</h3>
- </div>
- <div class="information">
- <div class="smalltext" style="font-weight: normal;"><a href="', $scripturl, '?action=helpadmin;help=search_why_use_index" onclick="return reqOverlayDiv(this.href);">', $txt['search_create_index_why'], '</a></div>
- </div>
-
- <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=managesearch;sa=method" method="post" accept-charset="', $context['character_set'], '">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['search_method'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <dl class="settings">
- ';
- if (!empty($context['table_info']))
- echo '
- <dt>
- <strong>', $txt['search_method_messages_table_space'], ':</strong>
- </dt>
- <dd>
- ', $context['table_info']['data_length'], '
- </dd>
- <dt>
- <strong>', $txt['search_method_messages_index_space'], ':</strong>
- </dt>
- <dd>
- ', $context['table_info']['index_length'], '
- </dd>';
- echo '
- </dl>
- ', $context['double_index'] ? '<div class="noticebox">
- ' . $txt['search_double_index'] . '</div>' : '', '
- <fieldset class="search_settings floatleft">
- <legend>', $txt['search_index'], '</legend>
- <dl>
- <dt><input type="radio" name="search_index" value=""', empty($modSettings['search_index']) ? ' checked="checked"' : '', ' class="input_radio" />
- ', $txt['search_index_none'], '
- </dt>';
- if ($context['supports_fulltext'])
- {
- echo '
- <dt>
- <input type="radio" name="search_index" value="fulltext"', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext' ? ' checked="checked"' : '', empty($context['fulltext_index']) ? ' onclick="alert(\'' . $txt['search_method_fulltext_warning'] . '\'); selectRadioByName(this.form.search_index, \'fulltext\');"': '', ' class="input_radio" />
- ', $txt['search_method_fulltext_index'], '
- </dt>
- <dd>
- <span class="smalltext">';
- if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext']))
- echo '
- <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]';
- elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext']))
- echo '
- <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create'];
- else
- echo '
- <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br />
- <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length'];
- echo '
- </span>
- </dd>';
- }
- echo '
- <dt>
- <input type="radio" name="search_index" value="custom"', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom' ? ' checked="checked"' : '', $context['custom_index'] ? '' : ' onclick="alert(\'' . $txt['search_index_custom_warning'] . '\'); selectRadioByName(this.form.search_method, \'1\');"', ' class="input_radio" />
- ', $txt['search_index_custom'], '
- </dt>
- <dd>
- <span class="smalltext">';
- if ($context['custom_index'])
- echo '
- <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br />
- <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
- elseif ($context['partial_custom_index'])
- echo '
- <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br />
- <strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length'];
- else
- echo '
- <strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]';
- echo '
- </span>
- </dd>';
- foreach ($context['search_apis'] as $api)
- {
- if (empty($api['label']) || $api['has_template'])
- continue;
- echo '
- <dt>
- <input type="radio" name="search_index" value="', $api['setting_index'], '"', !empty($modSettings['search_index']) && $modSettings['search_index'] == $api['setting_index'] ? ' checked="checked"' : '', ' class="input_radio" />
- ', $api['label'] ,'
- </dt>';
- if ($api['desc'])
- echo '
- <dd>
- <span class="smalltext">', $api['desc'], '</span>
- </dd>';
- }
- echo '
- </dl>
- </fieldset>
- <fieldset class="search_settings floatright">
- <legend>', $txt['search_method'], '</legend>
- <input type="checkbox" name="search_force_index" id="search_force_index_check" value="1"', empty($modSettings['search_force_index']) ? '' : ' checked="checked"', ' class="input_check" /><label for="search_force_index_check">', $txt['search_force_index'], '</label><br />
- <input type="checkbox" name="search_match_words" id="search_match_words_check" value="1"', empty($modSettings['search_match_words']) ? '' : ' checked="checked"', ' class="input_check" /><label for="search_match_words_check">', $txt['search_match_words'], '</label>
- </fieldset>
- <br class="clear"/>
- <input type="submit" name="save" value="', $txt['search_method_save'], '" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- <input type="hidden" name="', $context['admin-msmpost_token_var'], '" value="', $context['admin-msmpost_token'], '" />
- </div>
- </div>
- </form>
- </div>';
- }
- function template_create_index()
- {
- global $context, $settings, $options, $scripturl, $txt;
- echo '
- <div id="admincenter">
- <form action="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;step=1" method="post" accept-charset="', $context['character_set'], '" name="create_index">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['search_create_index'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <dl class="settings">
- <dt>
- <label for="predefine_select">', $txt['search_predefined'], ':</label>
- </dt>
- <dd>
- <select name="bytes_per_word" id="predefine_select">
- <option value="2">', $txt['search_predefined_small'], '</option>
- <option value="4" selected="selected">', $txt['search_predefined_moderate'], '</option>
- <option value="5">', $txt['search_predefined_large'], '</option>
- </select>
- </dd>
- </dl>
- <hr class="hrcolor" />
- <input type="submit" name="save" value="', $txt['search_create_index_start'], '" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- </div>
- </div>
- </form>
- </div>';
- }
- function template_create_index_progress()
- {
- global $context, $settings, $options, $scripturl, $txt;
- echo '
- <div id="admincenter">
- <form action="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;step=1" name="autoSubmit" method="post" accept-charset="', $context['character_set'], '">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['search_create_index'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <div><p>',
- $txt['search_create_index_not_ready'], '</p>
- <div class="progress_bar">
- <div class="full_bar">', $context['percentage'], '%</div>
- <div class="green_percent" style="width: ', $context['percentage'], '%;"> </div>
- </div>
- </div>
- <hr class="hrcolor" />
- <input type="submit" name="b" value="', $txt['search_create_index_continue'], '" class="button_submit" />
- </div>
- </div>
- <input type="hidden" name="step" value="', $context['step'], '" />
- <input type="hidden" name="start" value="', $context['start'], '" />
- <input type="hidden" name="bytes_per_word" value="', $context['index_settings']['bytes_per_word'], '" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- </form>
- </div>
- <script type="text/javascript"><!-- // --><![CDATA[
- var countdown = 10;
- doAutoSubmit();
- function doAutoSubmit()
- {
- if (countdown == 0)
- document.forms.autoSubmit.submit();
- else if (countdown == -1)
- return;
- document.forms.autoSubmit.b.value = "', $txt['search_create_index_continue'], ' (" + countdown + ")";
- countdown--;
- setTimeout("doAutoSubmit();", 1000);
- }
- // ]]></script>';
- }
- function template_create_index_done()
- {
- global $context, $settings, $options, $scripturl, $txt;
- echo '
- <div id="admincenter">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['search_create_index'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <p>', $txt['search_create_index_done'], '</p>
- <p>
- <strong><a href="', $scripturl, '?action=admin;area=managesearch;sa=method">', $txt['search_create_index_done_link'], '</a></strong>
- </p>
- </div>
- </div>
- </div>';
- }
- // Add or edit a search engine spider.
- function template_spider_edit()
- {
- global $context, $settings, $options, $scripturl, $txt;
- echo '
- <div id="admincenter">
- <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=sengines;sa=editspiders;sid=', $context['spider']['id'], '" method="post" accept-charset="', $context['character_set'], '">
- <div class="cat_bar">
- <h3 class="catbg">', $context['page_title'], '</h3>
- </div>
- <div class="information">
- ', $txt['add_spider_desc'], '
- </div>
- <div class="windowbg">
- <div class="content">
- <dl class="settings">
- <dt>
- <strong><label for="spider_name">', $txt['spider_name'], ':</label></strong><br />
- <span class="smalltext">', $txt['spider_name_desc'], '</span>
- </dt>
- <dd>
- <input type="text" name="spider_name" id="spider_name" value="', $context['spider']['name'], '" class="input_text" />
- </dd>
- <dt>
- <strong><label for="spider_agent">', $txt['spider_agent'], ':</label></strong><br />
- <span class="smalltext">', $txt['spider_agent_desc'], '</span>
- </dt>
- <dd>
- <input type="text" name="spider_agent" id="spider_agent" value="', $context['spider']['agent'], '" class="input_text" />
- </dd>
- <dt>
- <strong><label for="spider_ip">', $txt['spider_ip_info'], ':</label></strong><br />
- <span class="smalltext">', $txt['spider_ip_info_desc'], '</span>
- </dt>
- <dd>
- <textarea name="spider_ip" id="spider_ip" rows="4" cols="20">', $context['spider']['ip_info'], '</textarea>
- </dd>
- </dl>
- <hr class="hrcolor" />
- <input type="submit" name="save" value="', $context['page_title'], '" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- <input type="hidden" name="', $context['admin-ses_token_var'], '" value="', $context['admin-ses_token'], '" />
- </div>
- </div>
- </form>
- </div>';
- }
- // Show... spider... logs...
- function template_show_spider_logs()
- {
- global $context, $txt, $settings, $scripturl;
- echo '
- <div id="admincenter">';
- // Standard fields.
- template_show_list('spider_logs');
- echo '
- <br class="clear" />
- <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=sengines;sa=logs" method="post" accept-charset="', $context['character_set'], '">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['spider_logs_delete'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <p>
- ', $txt['spider_logs_delete_older'], '
- <input type="text" name="older" id="older" value="7" size="3" class="input_text" />
- ', $txt['spider_logs_delete_day'], '
- </p>
- <input type="submit" name="delete_entries" value="', $txt['spider_logs_delete_submit'], '" onclick="if (document.getElementById(\'older\').value < 1 && !confirm(\'' . addcslashes($txt['spider_logs_delete_confirm'], "'") . '\')) return false; return true;" class="button_submit" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- <input type="hidden" name="', $context['admin-sl_token_var'], '" value="', $context['admin-sl_token'], '" />
- </div>
- </div>
- </form>
- </div>';
- }
- // Show... spider... stats...
- function template_show_spider_stats()
- {
- global $context, $txt, $settings, $scripturl;
- echo '
- <div id="admincenter">';
- // Standard fields.
- template_show_list('spider_stat_list');
- echo '
- <form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=sengines;sa=stats" method="post" accept-charset="', $context['character_set'], '">
- <div class="cat_bar">
- <h3 class="catbg">', $txt['spider_logs_delete'], '</h3>
- </div>
- <div class="windowbg">
- <div class="content">
- <p>
- ', sprintf($txt['spider_stats_delete_older'], '<input type="text" name="older" id="older" value="90" size="3" class="input_text" />'), '
- </p>
- <hr class="hrcolor" />
- <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
- <input type="hidden" name="', $context['admin-ss_token_var'], '" value="', $context['admin-ss_token'], '" />
- <input type="submit" name="delete_entries" value="', $txt['spider_logs_delete_submit'], '" onclick="if (document.getElementById(\'older\').value < 1 && !confirm(\'' . addcslashes($txt['spider_logs_delete_confirm'], "'") . '\')) return false; return true;" class="button_submit" />
- <br />
- </div>
- </div>
- </form>
- </div>';
- }
- ?>
|