/** * Template to display all of the shouts in a system */ function template_shoutbox_all_default() { global $context, $txt; echo ' <h3 class="category_header"> ', $context['SPortal']['shoutbox']['name'], ' </h3> <div class="sp_content_padding">'; template_pagesection(); echo ' <div class="shoutbox_body"> <ul class="shoutbox_list_all" id="shouts">'; if (!empty($context['SPortal']['shouts_history'])) { foreach ($context['SPortal']['shouts_history'] as $shout) { echo ' ', !$shout['is_me'] ? '<li class="smalltext"><strong>' . $shout['author']['link'] . ':</strong></li>' : '', ' <li class="smalltext">', str_replace('ignored_shout', 'history_ignored_shout', $shout['text']), '</li> <li class="smalltext shoutbox_time">', $shout['delete_link'], $shout['time'], '</li>'; } } else { echo ' <li class="smalltext">', $txt['sp_shoutbox_no_shout'], '</li>'; } echo ' </ul> </div>'; template_pagesection(); echo ' </div>'; }
function template_view_category() { global $context, $txt; echo ' <div id="sp_view_category"> <h3 class="category_header"> ', $context['page_title'], ' </h3>'; if (empty($context['articles'])) { echo ' <div class="windowbg2"> <div class="sp_content_padding">', $txt['error_sp_no_articles'], '</div> </div>'; } foreach ($context['articles'] as $article) { echo ' <div class="windowbg2"> <div class="sp_content_padding"> <div class="sp_article_detail">'; if (!empty($article['author']['avatar']['image'])) { echo $article['author']['avatar']['image']; } echo ' <span class="sp_article_latest"> ', sprintf(!empty($context['using_relative_time']) ? $txt['sp_posted_on_in_by'] : $txt['sp_posted_in_on_by'], $article['category']['link'], $article['date'], $article['author']['link']), ' <br /> ', sprintf($article['views'] == 1 ? $txt['sp_viewed_time'] : $txt['sp_viewed_times'], $article['views']), ', ', sprintf($article['comments'] == 1 ? $txt['sp_commented_on_time'] : $txt['sp_commented_on_times'], $article['comments']), ' </span> <h4>', $article['link'], '</h4> </div> <hr /> <p>', $article['preview'], '<a href="', $article['href'], '">...</a></p> <div class="sp_article_extra"> <a href="', $article['href'], '">', $txt['sp_read_more'], '</a> | <a href="', $article['href'], '#sp_view_comments">', $txt['sp_write_comment'], '</a> </div> </div> </div>'; } echo ' </div>'; // Pages as well? if (!empty($context['page_index'])) { template_pagesection(); } if (!empty($context['using_relative_time'])) { echo ' <script><!-- // --><![CDATA[ $(\'.sp_article_latest\').addClass(\'relative\'); // ]]></script>'; } }
/** * Used to display articles on the portal */ function template_portal_index() { global $context, $txt; if (empty($context['articles'])) { return; } echo ' <div id="sp_index" class="sp_article_block_container">'; foreach ($context['articles'] as $article) { echo ' <h3 class="category_header"> ', $article['link'], ' </h3> <div class="sp_block_section"> <div class="sp_content_padding"> <div class="sp_article_detail">'; if (!empty($article['author']['avatar']['image'])) { echo $article['author']['avatar']['image']; } echo ' <span> ', sprintf($txt['sp_posted_in_on_by'], $article['category']['link'], $article['date'], $article['author']['link']); if (!empty($article['author']['avatar']['image'])) { echo ' <br />'; } else { echo ' </span> <span class="floatright">'; } echo ' ', sprintf($article['view_count'] == 1 ? $txt['sp_viewed_time'] : $txt['sp_viewed_times'], $article['view_count']), ', ', sprintf($article['comment_count'] == 1 ? $txt['sp_commented_on_time'] : $txt['sp_commented_on_times'], $article['comment_count']), ' </span> </div> <hr /> <p>', $article['preview'], '<a href="', $article['href'], '">...</a></p> <div class="sp_article_extra"> <a href="', $article['href'], '">', $txt['sp_read_more'], '</a> | <a href="', $article['href'], '#sp_view_comments">', $txt['sp_write_comment'], '</a> </div> </div> </div>'; } // Pages as well? if (!empty($context['article_page_index'])) { echo ' <div class="sp_page_index">', template_pagesection(), ' </div>'; } echo ' </div>'; }
/** * Shows the pagination */ function template_mlsearch_below() { global $context, $scripturl, $txt; // Show the page numbers again. (makes 'em easier to find!) template_pagesection(false, false); echo ' </div>'; }
/** * Template to allow merge of two topics. */ function template_merge() { global $context, $txt, $scripturl, $settings; echo ' <div id="merge_topics"> <h2 class="category_header">', $txt['merge'], '</h2> <div class="information"> ', $txt['merge_desc'], ' </div> <div class="windowbg"> <div class="content"> <dl class="settings merge_topic"> <dt> <strong>', $txt['topic_to_merge'], ':</strong> </dt> <dd> ', $context['origin_subject'], ' </dd>'; if (!empty($context['boards']) && count($context['boards']) > 1) { echo ' <dt> <strong>', $txt['target_board'], ':</strong> </dt> <dd> <form action="' . $scripturl . '?action=mergetopics;from=', $context['origin_topic'] . ';targetboard=' . $context['target_board'], ';board=', $context['current_board'], '.0" method="post" accept-charset="UTF-8"> <input type="hidden" name="from" value="' . $context['origin_topic'] . '" /> <select name="targetboard" onchange="this.form.submit();">'; foreach ($context['boards'] as $board) { echo ' <option value="', $board['id'], '"', $board['id'] == $context['target_board'] ? ' selected="selected"' : '', '>', $board['category'], ' - ', $board['name'], '</option>'; } echo ' </select> <input type="submit" value="', $txt['go'], '" class="button_submit submitgo" /> </form> </dd>'; } echo ' </dl> <hr /> <dl class="settings merge_topic"> <dt> <strong><label for="topics">', $txt['merge_to_topic_id'], '</label>: </strong> </dt> <dd> <form action="', $scripturl, '?action=mergetopics;sa=options" method="post" accept-charset="UTF-8"> <input type="hidden" name="topics[]" value="', $context['origin_topic'], '" /> <input type="text" id="topics" name="topics[]" class="input_text" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="submit" value="', $txt['merge'], '" class="button_submit submitgo" /> </form> </dd>'; echo ' </dl> </div> </div><br /> <h3 class="category_header">', $txt['target_topic'], '</h3> ', template_pagesection(), ' <div class="windowbg2"> <div class="content"> <ul class="merge_topics">'; foreach ($context['topics'] as $topic) { echo ' <li> <a class="linkbutton" href="', $scripturl, '?action=mergetopics;sa=options;board=', $context['current_board'], '.0;from=', $context['origin_topic'], ';to=', $topic['id'], ';', $context['session_var'], '=', $context['session_id'], '"> <img class="centericon" src="', $settings['images_url'], '/buttons/merge.png" alt="', $txt['merge'], '" /> </a> <a href="', $scripturl, '?topic=', $topic['id'], '.0" target="_blank" class="new_win">', $topic['subject'], '</a> ', sprintf($txt['topic_started_by'], $topic['poster']['link']), ' </li>'; } echo ' </ul> </div> </div>', template_pagesection(), ' </div>'; }
/** * Displays the search results page. */ function template_results() { global $context, $settings, $options, $txt, $scripturl, $message; // Let them know if we ignored a word in the search if (!empty($context['search_ignored'])) { echo ' <div id="search_results"> <h3 class="category_header"> ', $txt['generic_warning'], ' </h3> <p class="warningbox">', $txt['search_warning_ignored_word' . (count($context['search_ignored']) == 1 ? '' : 's')], ': ', implode(', ', $context['search_ignored']), '</p> </div>'; } // Or perhaps they made a spelling error, lets give them a hint if (isset($context['did_you_mean']) || empty($context['topics'])) { echo ' <div id="search_results"> <h2 class="category_header">', $txt['search_adjust_query'], '</h2> <div class="roundframe">'; // Did they make any typos or mistakes, perhaps? if (isset($context['did_you_mean'])) { echo ' <p>', $txt['search_did_you_mean'], ' <a href="', $scripturl, '?action=search;sa=results;params=', $context['did_you_mean_params'], '">', $context['did_you_mean'], '</a>.</p>'; } echo ' <form action="', $scripturl, '?action=search;sa=results" method="post" accept-charset="UTF-8"> <dl class="settings"> <dt class="righttext"> <label for="search"><strong>', $txt['search_for'], ':</strong></label> </dt> <dd> <input type="text" id="search" name="search" value="', $context['search_params']['search'], '" maxlength="', $context['search_string_limit'], '" size="40" class="input_text" /> </dd> </dl> <div class="submitbutton" > <input type="submit" name="edit_search" value="', $txt['search_adjust_submit'], '" class="button_submit" /> <input type="hidden" name="searchtype" value="', $context['search_params']['searchtype'], '" /> <input type="hidden" name="userspec" value="', $context['search_params']['userspec'], '" /> <input type="hidden" name="show_complete" value="', $context['search_params']['show_complete'], '" /> <input type="hidden" name="subject_only" value="', $context['search_params']['subject_only'], '" /> <input type="hidden" name="minage" value="', $context['search_params']['minage'], '" /> <input type="hidden" name="maxage" value="', $context['search_params']['maxage'], '" /> <input type="hidden" name="sort" value="', $context['search_params']['sort'], '" /> </div>'; if (!empty($context['search_params']['brd'])) { foreach ($context['search_params']['brd'] as $board_id) { echo ' <input type="hidden" name="brd[', $board_id, ']" value="', $board_id, '" />'; } } echo ' </form> </div> </div> <br />'; } // Quick moderation set to checkboxes? Oh, how fun :/. if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { echo ' <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="UTF-8" name="topicForm" id="topicForm" class="search_results_posts', $context['compact'] ? ' compact_view' : '', '">'; } echo ' <h3 class="category_header hdicon cat_img_search"> <span class="floatright">'; if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { echo ' <input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />'; } echo ' </span> ', $txt['mlist_search_results'], ': ', $context['search_params']['search'], ' </h3>'; // Was anything even found? if (!empty($context['topics'])) { template_pagesection(); } else { echo ' <div class="roundframe">', $txt['find_no_results'], '</div>'; } if ($context['compact']) { echo ' <ul class="topic_listing compact_view search_results_posts">'; } else { echo ' <ul class="core_posts topic_listing search_results_posts">'; } // While we have results to show ... $controller = $context['get_topics'][0]; while ($topic = $controller->{$context['get_topics'][1]}()) { if ($context['compact']) { // We start with locked and sticky topics. if ($topic['is_sticky'] && $topic['is_locked']) { $color_class = 'locked_row sticky_row'; } elseif ($topic['is_sticky']) { $color_class = 'sticky_row'; } elseif ($topic['is_locked']) { $color_class = 'locked_row'; } else { $color_class = 'basic_row'; } } else { $color_class = $message['alternate'] == 0 ? 'windowbg' : 'windowbg2'; } foreach ($topic['matches'] as $message) { echo ' <li class="', $color_class, '"> <div class="topic_details"> <div class="counter">', $message['counter'], '</div> <h5>', $topic['board']['link'], ' / <a href="', $scripturl, '?topic=', $topic['id'], '.msg', $message['id'], '#msg', $message['id'], '">', $message['subject_highlighted'], '</a></h5> <span class="smalltext">« ', $txt['by'], ' <strong>', $message['member']['link'], '</strong> ', $txt['on'], ' <em>', $message['time'], '</em> »</span>'; echo ' </div>'; if (!$context['compact'] || $message['body_highlighted'] != '') { echo ' <div class="topic_body">', $message['body_highlighted'], '</div>'; } if (!empty($topic['buttons'])) { template_quickbutton_strip($topic['buttons'], $topic['tests']); } if (!empty($options['display_quick_mod'])) { echo ' <p class="topic_moderation">'; if ($options['display_quick_mod'] == 1) { echo ' <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" />'; } else { if ($topic['quick_mod']['remove']) { echo ' <a href="', $scripturl, '?action=quickmod;actions%5B', $topic['id'], '%5D=remove;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_remove.png" style="width: 16px;" alt="', $txt['remove_topic'], '" title="', $txt['remove_topic'], '" /></a>'; } if ($topic['quick_mod']['lock']) { echo ' <a href="', $scripturl, '?action=quickmod;actions%5B', $topic['id'], '%5D=lock;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_lock.png" style="width: 16px;" alt="', $txt[$topic['is_locked'] ? 'set_unlock' : 'set_lock'], '" title="', $txt[$topic['is_locked'] ? 'set_unlock' : 'set_lock'], '" /></a>'; } if ($topic['quick_mod']['lock'] || $topic['quick_mod']['remove']) { echo ' <br />'; } if ($topic['quick_mod']['sticky']) { echo ' <a href="', $scripturl, '?action=quickmod;actions%5B', $topic['id'], '%5D=sticky;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['quickmod_confirm'], '\');"><img src="', $settings['images_url'], '/icons/quick_sticky.png" style="width: 16px;" alt="', $txt[$topic['is_sticky'] ? 'set_nonsticky' : 'set_sticky'], '" title="', $txt[$topic['is_sticky'] ? 'set_nonsticky' : 'set_sticky'], '" /></a>'; } if ($topic['quick_mod']['move']) { echo ' <a href="', $scripturl, '?action=movetopic;topic=', $topic['id'], '.0"><img src="', $settings['images_url'], '/icons/quick_move.png" style="width: 16px;" alt="', $txt['move_topic'], '" title="', $txt['move_topic'], '" /></a>'; } } echo ' </p>'; } echo ' </li>'; } } echo ' </ul>'; // If we have results show a page index if (!empty($context['topics'])) { template_pagesection(); } // Quick moderation enabled, then show an action area if (!empty($context['topics']) && !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1) { echo ' <div class="search_controls floatright"> <div class="additional_row"> <select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.move_to.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '> <option value=""> </option>'; foreach ($context['qmod_actions'] as $qmod_action) { if ($context['can_' . $qmod_action]) { echo ' <option value="' . $qmod_action . '">' . (isBrowser('ie8') ? '»' : '➤') . ' ', $txt['quick_mod_' . $qmod_action] . '</option>'; } } echo ' </select>'; // Show a list of boards they can move the topic to. if ($context['can_move']) { echo ' <span id="quick_mod_jump_to"> </span>'; } echo ' <input type="hidden" name="redirect_url" value="', $scripturl . '?action=search;sa=results;params=' . $context['params'], '" /> <input class="button_submit" type="submit" value="', $txt['quick_mod_go'], '" onclick="return document.forms.topicForm.qaction.value != \'\' && confirm(\'', $txt['quickmod_confirm'], '\');" /> </div> </div>'; echo ' <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" /> </form>'; } // Show a jump to box for easy navigation. echo ' <div class="floatright" id="search_jump_to"> </div>'; if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { addInlineJavascript(' aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "quick_mod_jump_to", sClassName: "qaction", sJumpToTemplate: "%dropdown_list%", sCurBoardName: "' . $context['jump_to']['board_name'] . '", sBoardChildLevelIndicator: " ", sBoardPrefix: "' . (isBrowser('ie8') ? '»' : '➤') . ' ", sCatClass: "jump_to_header", sCatPrefix: "", bNoRedirect: true, bDisabled: true, sCustomName: "move_to" });', true); } addInlineJavascript(' aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "search_jump_to", sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">' . $context['jump_to']['label'] . ':<" + "/label> %dropdown_list%", iCurBoardId: 0, iCurBoardChildLevel: 0, sCurBoardName: "' . $context['jump_to']['board_name'] . '", sBoardChildLevelIndicator: " ", sBoardPrefix: "' . (isBrowser('ie8') ? '»' : '➤') . ' ", sCatClass: "jump_to_header", sCatPrefix: "", sGoButtonLabel: "' . $txt['quick_mod_go'] . '" });', true); }
/** * Show a list of all the unapproved posts or topics * Provides links to approve to remove each */ function template_unapproved_posts() { global $options, $context, $txt, $scripturl; // Just a big div of it all really... echo ' <form action="', $scripturl, '?action=moderate;area=postmod;start=', $context['start'], ';sa=', $context['current_view'], '" method="post" accept-charset="UTF-8"> <h2 class="category_header hdicon cat_img_posts"> ', $context['header_title'], ' </h2>'; // No posts? if (empty($context['unapproved_items'])) { echo ' <div class="windowbg2 core_posts"> <p class="centertext">', $txt['mc_unapproved_' . $context['current_view'] . '_none_found'], '</p> </div>'; } else { template_pagesection(); } // Loop through and show each unapproved post foreach ($context['unapproved_items'] as $item) { $item['class'] = $item['alternate'] == 0 ? 'windowbg2' : 'windowbg'; $item['title'] = '<h5><strong>' . $item['category']['link'] . ' / ' . $item['board']['link'] . ' / ' . $item['link'] . '</strong></h5>'; $item['date'] = $txt['mc_unapproved_by'] . ' <strong>' . $item['poster']['link'] . '</strong> : ' . $item['time']; template_simple_message($item); } // Quick moderation checkbox action selection $quick_mod = ''; if (!empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['unapproved_items'])) { $quick_mod = ' <div class="floatright"> <select name="do" onchange="if (this.value != 0 && confirm(\'' . $txt['mc_unapproved_sure'] . '\')) submit();"> <option value="0">' . $txt['with_selected'] . ':</option> <option value="0" disabled="disabled">' . str_repeat('—', strlen($txt['approve'])) . '</option> <option value="approve">' . (isBrowser('ie8') ? '»' : '➤') . ' ' . $txt['approve'] . '</option> <option value="delete">' . (isBrowser('ie8') ? '»' : '➤') . ' ' . $txt['remove'] . '</option> </select> <noscript> <input type="submit" name="mc_go" value="' . $txt['go'] . '" class="button_submit submitgo" /> </noscript> </div>'; } if (!empty($context['unapproved_items'])) { template_pagesection(false, false, array('extra' => $quick_mod)); } echo ' <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> </form>'; }
function template_unread_below() { global $context; if (!empty($context['topics'])) { template_pagesection('recent_buttons', 'right'); echo ' <div id="topic_icons" class="description">'; template_basicicons_legend(); if (!empty($context['using_relative_time'])) { echo ' <script><!-- // --><![CDATA[ $(\'.topic_latest\').addClass(\'relative\'); // ]]></script>'; } echo ' </div>'; } }
/** * Template for showing all the drafts of the user. */ function template_showDrafts() { global $context, $settings, $txt, $scripturl; if (!empty($context['drafts'])) { template_pagesection(); } echo ' <div id="profilecenter"> <form action="', $scripturl, '?action=profile;u=' . $context['member']['id'] . ';area=showdrafts;delete" method="post" accept-charset="UTF-8" name="draftForm" id="draftForm" > <h2 class="category_header"> <span class="floatright"> <input type="checkbox" onclick="invertAll(this, this.form, \'delete[]\');" class="input_check" /> </span> ', $txt['drafts'], ' </h2>'; // No drafts? Just show an informative message. if (empty($context['drafts'])) { echo ' <div class="information centertext"> ', $txt['draft_none'], ' </div>'; } else { // For every draft to be displayed show the important details. foreach ($context['drafts'] as $draft) { $draft['title'] = '<strong>' . $draft['board']['link'] . ' / ' . $draft['topic']['link'] . '</strong> '; if (!empty($draft['sticky'])) { $draft['title'] .= '<img src="' . $settings['images_url'] . '/icons/quick_sticky.png" alt="' . $txt['sticky_topic'] . '" title="' . $txt['sticky_topic'] . '" />'; } if (!empty($draft['locked'])) { $draft['title'] .= '<img src="' . $settings['images_url'] . '/icons/quick_lock.png" alt="' . $txt['locked_topic'] . '" title="' . $txt['locked_topic'] . '" />'; } $draft['date'] = '« <strong>' . $txt['draft_saved_on'] . ':</strong> ' . ($draft['age'] > 0 ? sprintf($txt['draft_days_ago'], $draft['age']) : $draft['time']) . (!empty($draft['remaining']) ? ', ' . sprintf($txt['draft_retain'], $draft['remaining']) : '') . ' »'; $draft['class'] = $draft['alternate'] === 0 ? 'windowbg2' : 'windowbg'; template_simple_message($draft); } } // Show page numbers if (!empty($context['drafts'])) { echo ' <div class="flow_auto"> <div class="floatleft">'; template_pagesection(); echo ' </div> <div class="additional_row below_table_data"> <input type="submit" name="delete_selected" value="' . $txt['quick_mod_remove'] . '" class="right_submit" onclick="return confirm(' . JavaScriptEscape($txt['draft_remove_selected'] . '?') . ');" /> <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" /> </div> </div>'; } echo ' </form> </div>'; }
/** * Template for viewing a specific article in the system * Also used to preview an article from the new article form */ function template_view_article() { global $context, $txt; echo ' <div id="sp_view_article"> <h3 class="category_header"> ', $context['article']['title'], ' </h3> <div class="sp_content_padding"> <div class="sp_article_detail">'; if (!empty($context['article']['author']['avatar']['image'])) { echo $context['article']['author']['avatar']['image']; } echo ' <span class="sp_article_latest"> ', sprintf(!empty($context['using_relative_time']) ? $txt['sp_posted_on_in_by'] : $txt['sp_posted_in_on_by'], $context['article']['category']['link'], $context['article']['date'], $context['article']['author']['link']); if (!empty($context['article']['author']['avatar']['image'])) { echo ' <br />'; } else { echo ' </span> <span class="floatright">'; } echo ' ', sprintf($context['article']['view_count'] == 1 ? $txt['sp_viewed_time'] : $txt['sp_viewed_times'], $context['article']['view_count']), ', ', sprintf($context['article']['comment_count'] == 1 ? $txt['sp_commented_on_time'] : $txt['sp_commented_on_times'], $context['article']['comment_count']), ' </span> </div> <hr /> <div>', $context['article']['body'], ' </div> </div>'; // Not just previewing the new article? if (empty($context['preview'])) { echo ' <div id="sp_view_comments"> <h3 class="category_header"> ', $txt['sp-comments'], ' </h3>'; if (empty($context['article']['comments'])) { echo ' <div class="infobox"> ', $txt['error_sp_no_comments'], ' </div>'; } foreach ($context['article']['comments'] as $comment) { echo ' <div id="comment', $comment['id'], '" class="content"> <div class="sp_content_padding flow_auto"> <div class="sp_comment_detail">'; if (!empty($comment['author']['avatar']['image'])) { echo $comment['author']['avatar']['image']; } // Show the edit icons if they are allowed if ($comment['can_moderate']) { echo ' <div class="floatright"> <a href="', $context['article']['href'], ';modify=', $comment['id'], ';', $context['session_var'], '=', $context['session_id'], '#sp_comment">', sp_embed_image('modify'), '</a> <a href="', $context['article']['href'], ';delete=', $comment['id'], ';', $context['session_var'], '=', $context['session_id'], '">', sp_embed_image('delete'), '</a> </div>'; } echo ' <span class="sp_article_latest">', sprintf($txt['sp_posted_by'], $comment['time'], $comment['author']['link']), '</span> </div> <hr /> <p class="sp_comment_body"> ', $comment['body'], ' </p> </div> </div>'; } // Pages as well? if (!empty($context['page_index'])) { template_pagesection(); } // Show the comment box if ($context['article']['can_comment']) { echo ' <div id="sp_comment" class="sp_content_padding"> <form action="', $context['article']['href'], '" method="post" accept-charset="UTF-8"> <textarea name="body" rows="5" cols="50" style="width: 100%;padding: 0.1em 0.2em" tabindex="', $context['tabindex']++, '">', !empty($context['article']['comment']['body']) ? $context['article']['comment']['body'] : '', '</textarea> <div class="submitbutton"> <input type="submit" name="submit" value="', !empty($context['article']['comment']) ? $txt['sp_modify'] : $txt['sp_submit'], '" class="right_submit" /> <input type="hidden" name="comment" value="', !empty($context['article']['comment']['id']) ? $context['article']['comment']['id'] : 0, '" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> </div> </form> </div>'; } echo ' </div>'; } echo ' </div>'; if (!empty($context['using_relative_time'])) { addInlineJavascript('$(\'.sp_article_latest\').addClass(\'relative\');', true); } }
/** * Template for viewing the members of a group. */ function template_group_members() { global $context, $settings, $scripturl, $txt; echo ' <div id="admincenter"> <form action="', $scripturl, '?action=', $context['current_action'], isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '', ';sa=members;group=', $context['group']['id'], '" method="post" accept-charset="UTF-8" id="view_group"> <h2 class="category_header">', $context['page_title'], '</h2> <div class="windowbg"> <div class="content"> <dl class="settings"> <dt> <strong>', $txt['name'], ':</strong> </dt> <dd> <span ', $context['group']['online_color'] ? 'style="color: ' . $context['group']['online_color'] . ';"' : '', '>', $context['group']['name'], '</span> ', $context['group']['icons'], ' </dd>'; // Any description to show? if (!empty($context['group']['description'])) { echo ' <dt> <strong>' . $txt['membergroups_members_description'] . ':</strong> </dt> <dd> ', $context['group']['description'], ' </dd>'; } echo ' <dt> <strong>', $txt['membergroups_members_top'], ':</strong> </dt> <dd> ', $context['total_members'], ' </dd>'; // Any group moderators to show? if (!empty($context['group']['moderators'])) { $moderators = array(); foreach ($context['group']['moderators'] as $moderator) { $moderators[] = '<a href="' . $scripturl . '?action=profile;u=' . $moderator['id'] . '">' . $moderator['name'] . '</a>'; } echo ' <dt> <strong>', $txt['membergroups_members_group_moderators'], ':</strong> </dt> <dd> ', implode(', ', $moderators), ' </dd>'; } echo ' </dl> </div> </div> <h3 class="category_header">', $txt['membergroups_members_group_members'], '</h3> ', template_pagesection(), ' <table class="table_grid"> <thead> <tr class="table_head"> <th><a href="', $scripturl, '?action=', $context['current_action'], isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '', ';sa=members;start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['name'], $context['sort_by'] == 'name' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a></th>'; if ($context['can_send_email']) { echo ' <th><a href="', $scripturl, '?action=', $context['current_action'], isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '', ';sa=members;start=', $context['start'], ';sort=email', $context['sort_by'] == 'email' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['email'], $context['sort_by'] == 'email' ? ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a></th>'; } echo ' <th><a href="', $scripturl, '?action=', $context['current_action'], isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '', ';sa=members;start=', $context['start'], ';sort=active', $context['sort_by'] == 'active' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['membergroups_members_last_active'], $context['sort_by'] == 'active' ? '<img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a></th> <th><a href="', $scripturl, '?action=', $context['current_action'], isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '', ';sa=members;start=', $context['start'], ';sort=registered', $context['sort_by'] == 'registered' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['date_registered'], $context['sort_by'] == 'registered' ? '<img class="sort" src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a></th> <th ', empty($context['group']['assignable']) ? ' colspan="2"' : '', '><a href="', $scripturl, '?action=', $context['current_action'], isset($context['admin_area']) ? ';area=' . $context['admin_area'] : '', ';sa=members;start=', $context['start'], ';sort=posts', $context['sort_by'] == 'posts' && $context['sort_direction'] == 'up' ? ';desc' : '', ';group=', $context['group']['id'], '">', $txt['posts'], $context['sort_by'] == 'posts' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.png" alt="" />' : '', '</a></th>'; if (!empty($context['group']['assignable'])) { echo ' <th style="width: 4%;"><input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" /></th>'; } echo ' </tr> </thead> <tbody>'; if (empty($context['members'])) { echo ' <tr class="windowbg2"> <td colspan="6" class="centertext">', $txt['membergroups_members_no_members'], '</td> </tr>'; } $alternate = false; foreach ($context['members'] as $member) { $alternate = !$alternate; echo ' <tr class="', $alternate === true ? 'windowbg' : 'windowbg2', '"> <td>', $member['name'], '</td>'; if ($context['can_send_email']) { echo ' <td', $member['show_email'] == 'no_through_forum' && $settings['use_image_buttons'] ? ' class="centertext"' : '', '>'; // Is it totally hidden? if ($member['show_email'] == 'no') { echo ' <em>', $txt['hidden'], '</em>'; } elseif ($member['show_email'] == 'yes_permission_override') { echo ' <a href="mailto:', $member['email'], '"><em>', $member['email'], '</em></a>'; } elseif ($member['show_email'] == 'no_through_forum') { echo ' <a href="', $scripturl, '?action=emailuser;sa=email;uid=', $member['id'], '" rel="nofollow">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/profile/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . '" />' : $txt['email'], '</a>'; } else { echo ' <a href="mailto:', $member['email'], '">', $member['email'], '</a>'; } echo ' </td>'; } echo ' <td>', $member['last_online'], '</td> <td>', $member['registered'], '</td> <td', empty($context['group']['assignable']) ? ' colspan="2"' : '', '>', $member['posts'], '</td>'; if (!empty($context['group']['assignable'])) { echo ' <td class="centertext" style="width: 4%;"> <input type="checkbox" name="rem[]" value="', $member['id'], '" class="input_check" ', $context['user']['id'] == $member['id'] && $context['group']['id'] == 1 ? 'onclick="if (this.checked) return confirm(\'' . $txt['membergroups_members_deadmin_confirm'] . '\')" ' : '', '/> </td>'; } echo ' </tr>'; } echo ' </tbody> </table> <div class="flow_auto"> <div class="floatleft">'; template_pagesection(); echo ' </div> <div class="additional_row floatright">'; if (!empty($context['group']['assignable'])) { echo ' <input type="submit" name="remove" value="', $txt['membergroups_members_remove'], '" class="button_submit " />'; } echo ' </div> </div>'; if (!empty($context['group']['assignable'])) { echo ' <div class="additional_row"> <h3 class="category_header">', $txt['membergroups_members_add_title'], '</h3> <div class="windowbg"> <div class="content"> <dl class="settings"> <dt> <strong><label for="toAdd">', $txt['membergroups_members_add_desc'], ':</label></strong> </dt> <dd> <input type="text" name="toAdd" id="toAdd" value="" class="input_text" /> <div id="toAddItemContainer"></div> </dd> </dl> <input type="submit" name="add" value="', $txt['membergroups_members_add'], '" class="right_submit" /> </div> </div> </div>'; } echo ' <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['mod-mgm_token_var'], '" value="', $context['mod-mgm_token'], '" /> </form> </div>'; if (!empty($context['group']['assignable'])) { addInlineJavascript(' var oAddMemberSuggest = new smc_AutoSuggest({ sSelf: \'oAddMemberSuggest\', sSessionId: elk_session_id, sSessionVar: elk_session_var, sSuggestId: \'to_suggest\', sControlId: \'toAdd\', sSearchType: \'member\', sPostName: \'member_add\', sURLMask: \'action=profile;u=%item_id%\', sTextDeleteItem: \'' . $txt['autosuggest_delete_item'] . '\', bItemList: true, sItemListContainerId: \'toAddItemContainer\' });', true); } }
/** * Template used to show a list created with createlist * * @param string|null $list_id */ function template_show_list($list_id = null) { global $context, $settings, $txt; // Get a shortcut to the current list. $list_id = $list_id === null ? $context['default_list'] : $list_id; $cur_list =& $context[$list_id]; if (isset($cur_list['form'])) { echo ' <form class="generic_list_wrapper" action="', $cur_list['form']['href'], '" method="post"', empty($cur_list['form']['name']) ? '' : ' name="' . $cur_list['form']['name'] . '" id="' . $cur_list['form']['name'] . '"', ' accept-charset="UTF-8"> <div class="generic_list">'; } else { echo ' <div id="', $list_id, '" class="generic_list_wrapper">'; } // Show the title of the table (if any), with an icon (if defined) if (!empty($cur_list['title'])) { echo ' <h3 class="category_header', !empty($cur_list['icon']) ? ' hdicon cat_img_' . $cur_list['icon'] : '', '">', $cur_list['title'], '</h3>'; } // Show any data right after the title if (isset($cur_list['additional_rows']['after_title'])) { echo ' <div class="information flow_hidden">'; template_additional_rows('after_title', $cur_list); echo ' </div>'; } // Show some data above this list if (isset($cur_list['additional_rows']['top_of_list'])) { template_additional_rows('top_of_list', $cur_list); } $close_div = false; if (isset($cur_list['additional_rows']['above_column_headers'])) { $close_div = true; echo ' <div class="flow_auto">', template_additional_rows('above_column_headers', $cur_list); } // These are the main tabs that is used all around the template. if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'top')) { if (!$close_div) { echo ' <div class="flow_auto">'; } $close_div = true; template_create_list_menu($cur_list['list_menu']); } // Show the page index (if this list doesn't intend to show all items). @todo - Needs old top/bottom stuff cleaned up. if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) { if (!$close_div) { echo ' <div class="flow_auto">'; } echo ' <div class="floatleft">', template_pagesection(false, false, array('page_index_markup' => $cur_list['page_index'])), ' </div>'; $close_div = true; } if ($close_div) { echo ' </div>'; } // Start of the main table echo ' <table id="' . $list_id . '" class="table_grid"', !empty($cur_list['width']) ? ' style="width: ' . $cur_list['width'] . '"' : '', '>'; // Show the column headers. $header_count = count($cur_list['headers']); if (!($header_count < 2 && empty($cur_list['headers'][0]['label']))) { echo ' <thead> <tr class="table_head">'; // Loop through each column and add a table header. $i = 0; foreach ($cur_list['headers'] as $col_header) { $i++; if ($i === 1) { $col_header['class'] = empty($col_header['class']) ? '' : $col_header['class']; } elseif ($i === $header_count) { $col_header['class'] = empty($col_header['class']) ? '' : $col_header['class']; } $sort_title = $col_header['sort_image'] === 'up' ? $txt['sort_desc'] : $txt['sort_asc']; echo ' <th scope="col" id="header_', $list_id, '_', $col_header['id'], '"', empty($col_header['class']) ? '' : ' class="' . $col_header['class'] . '"', empty($col_header['style']) ? '' : ' style="' . $col_header['style'] . '"', empty($col_header['colspan']) ? '' : ' colspan="' . $col_header['colspan'] . '"', '>', empty($col_header['href']) ? '' : '<a href="' . $col_header['href'] . '" rel="nofollow">', empty($col_header['label']) ? ' ' : $col_header['label'], empty($col_header['href']) ? '' : (empty($col_header['sort_image']) ? '</a>' : ' <img class="sort" src="' . $settings['images_url'] . '/sort_' . $col_header['sort_image'] . '.png" alt="" title="' . $sort_title . '" /></a>'), '</th>'; } echo ' </tr> </thead>'; } echo ' <tbody', empty($cur_list['sortable']) ? '' : ' id="table_grid_sortable"', '>'; // Show a nice message informing there are no items in this list. // @todo - Nasty having styles and aligns still in the markup (IE6 stuffz). // @todo - Should be done via the class. if (empty($cur_list['rows']) && !empty($cur_list['no_items_label'])) { echo ' <tr> <td class="windowbg" colspan="', $cur_list['num_columns'], '" style="text-align:', !empty($cur_list['no_items_align']) ? $cur_list['no_items_align'] : 'center', '"><div class="padding">', $cur_list['no_items_label'], '</div></td> </tr>'; } elseif (!empty($cur_list['rows'])) { foreach ($cur_list['rows'] as $id => $row) { echo ' <tr class="standard_row ', $row['class'], '" id="list_', $list_id, '_', $id, '">'; foreach ($row['data'] as $row_data) { echo ' <td', empty($row_data['class']) ? '' : ' class="' . $row_data['class'] . '"', empty($row_data['style']) ? '' : ' style="' . $row_data['style'] . '"', '>', $row_data['value'], '</td>'; } echo ' </tr>'; } } echo ' </tbody> </table>'; echo ' <div class="flow_auto">'; // Do we have multiple pages to show or data to show below the table if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index']) || isset($cur_list['additional_rows']['below_table_data'])) { // Show the page index (if this list doesn't intend to show all items). if (!empty($cur_list['items_per_page']) && !empty($cur_list['page_index'])) { echo ' <div class="floatleft">', template_pagesection(false, false, array('page_index_markup' => $cur_list['page_index'])), ' </div>'; } if (isset($cur_list['additional_rows']['below_table_data'])) { template_additional_rows('below_table_data', $cur_list); } } // Tabs at the bottom. Usually bottom aligned. if (isset($cur_list['list_menu'], $cur_list['list_menu']['show_on']) && ($cur_list['list_menu']['show_on'] == 'both' || $cur_list['list_menu']['show_on'] == 'bottom')) { template_create_list_menu($cur_list['list_menu']); } echo ' </div>'; // Last chance to show more data, like buttons and links if (isset($cur_list['additional_rows']['bottom_of_list'])) { template_additional_rows('bottom_of_list', $cur_list); } if (isset($cur_list['form'])) { foreach ($cur_list['form']['hidden_fields'] as $name => $value) { echo ' <input type="hidden" name="', $name, '" value="', $value, '" />'; } echo ' </div> </form>'; } else { echo ' </div>'; } }
/** * Template for showing all the PM drafts of the user. */ function template_showPMDrafts() { global $context, $scripturl, $txt; echo ' <h2 class="category_header hdicon cat_img_talk"> ', $txt['drafts_show'], ' </h2>'; template_pagesection(); // No drafts? Just show an informative message. if (empty($context['drafts'])) { echo ' <div class="information centertext"> ', $txt['draft_none'], ' </div>'; } else { // For every draft to be displayed, give it its own div, and show the important details of the draft. foreach ($context['drafts'] as $draft) { echo ' <div class="', $draft['alternate'] === 0 ? 'windowbg2' : 'windowbg', ' core_posts"> <div class="counter">', $draft['counter'], '</div> <div class="topic_details"> <h5> <strong>', $draft['subject'], '</strong> </h5> <span class="smalltext">« <strong>', $txt['draft_saved_on'], ':</strong> ', sprintf($txt['draft_days_ago'], $draft['age']), !empty($draft['remaining']) ? ', ' . sprintf($txt['draft_retain'], $draft['remaining']) : '', '»</span> <br /> <span class="smalltext">« <strong>', $txt['to'], ':</strong> ', implode(', ', $draft['recipients']['to']), ' »</span> <br /> <span class="smalltext">« <strong>', $txt['pm_bcc'], ':</strong> ', implode(', ', $draft['recipients']['bcc']), ' »</span> </div> <div class="inner"> ', $draft['body'], ' </div> <ul class="quickbuttons"> <li class="listlevel1"> <a href="', $scripturl, '?action=pm;sa=showpmdrafts;id_draft=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" class="linklevel1 reply_button">', $txt['draft_edit'], '</a> </li> <li class="listlevel1"> <a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['draft_remove'], '?\');" class="linklevel1 remove_button">', $txt['draft_delete'], '</a> </li> </ul> </div>'; } } // Show page numbers. template_pagesection(); }
/** * Shows the search again button to allow editing the parameters */ function template_mlsearch_below() { global $context, $scripturl, $txt; // If it is displaying the result of a search show a "search again" link to edit their criteria. if (isset($context['old_search'])) { $extra = ' <a class="linkbutton_right" href="' . $scripturl . '?action=memberlist;sa=search;search=' . $context['old_search_value'] . '">' . $txt['mlist_search_again'] . '</a>'; } else { $extra = ''; } // Show the page numbers again. (makes 'em easier to find!) template_pagesection(false, false, array('extra' => $extra)); echo ' </div>'; }
/** * The lower icons and jump to. */ function template_topic_listing_below() { global $context, $txt, $options; if ($context['no_topic_listing']) { return; } template_pagesection('normal_buttons', 'right'); // Show breadcrumbs at the bottom too. theme_linktree(); echo ' <div id="topic_icons" class="description"> <div class="floatright" id="message_index_jump_to"> </div>'; if (!$context['no_topic_listing']) { template_basicicons_legend(); } echo ' <script><!-- // --><![CDATA['; if (!empty($context['using_relative_time'])) { echo ' $(\'.topic_latest\').addClass(\'relative\');'; } if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1 && !empty($context['topics']) && $context['can_move']) { echo ' aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "quick_mod_jump_to", sClassName: "qaction", sJumpToTemplate: "%dropdown_list%", iCurBoardId: ', $context['current_board'], ', iCurBoardChildLevel: ', $context['jump_to']['child_level'], ', sCurBoardName: "', $context['jump_to']['board_name'], '", sBoardChildLevelIndicator: " ", sBoardPrefix: "', isBrowser('ie8') ? '» ' : '➤ ', '", sCatClass: "jump_to_header", sCatPrefix: "", bNoRedirect: true, bDisabled: true, sCustomName: "move_to" });'; } echo ' aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "message_index_jump_to", sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%", iCurBoardId: ', $context['current_board'], ', iCurBoardChildLevel: ', $context['jump_to']['child_level'], ', sCurBoardName: "', $context['jump_to']['board_name'], '", sBoardChildLevelIndicator: " ", sBoardPrefix: "', isBrowser('ie8') ? '» ' : '➤ ', '", sCatPrefix: "", sCatClass: "jump_to_header", sGoButtonLabel: "', $txt['quick_mod_go'], '" }); // ]]></script> </div>'; // Javascript for inline editing. echo ' <script><!-- // --><![CDATA[ var oQuickModifyTopic = new QuickModifyTopic({ aHidePrefixes: Array("lockicon", "stickyicon", "pages", "newicon"), bMouseOnDiv: false, }); // ]]></script>'; }
/** * Shows the forum error log in all its detail * Supports filtering for viewing all errors of a 'type' */ function template_error_log() { global $context, $settings, $scripturl, $txt; echo ' <form class="generic_list_wrapper" action="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';start=', $context['start'], $context['has_filter'] ? $context['filter']['href'] : '', '" method="post" accept-charset="UTF-8"> <h3 class="category_header"> <a class="hdicon cat_img_helptopics help" href="', $scripturl, '?action=quickhelp;help=error_log" onclick="return reqOverlayDiv(this.href);" title="', $txt['help'], '"></a> ', $txt['errlog'], ' </h3> <div class="flow_auto"> <div class="floatleft">'; template_pagesection(); echo ' </div> <div class="additional_row floatright"> <input type="submit" name="removeSelection" value="' . $txt['remove_selection'] . '" onclick="return confirm(\'' . $txt['remove_selection_confirm'] . '\');" class="button_submit" /> <input type="submit" name="delall" value="', $context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all'], '" onclick="return confirm(\'', $context['has_filter'] ? $txt['remove_filtered_results_confirm'] : $txt['sure_about_errorlog_remove'], '\');" class="button_submit" /> </div> </div>'; echo ' <table class="table_grid" id="error_log"> <tr> <td colspan="3" class="windowbg"> ', $txt['apply_filter_of_type'], ':'; $error_types = array(); foreach ($context['error_types'] as $type => $details) { $error_types[] = ($details['is_selected'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt="" /> ' : '') . '<a href="' . $details['url'] . '" ' . ($details['is_selected'] ? 'style="font-weight: bold;"' : '') . ' title="' . $details['description'] . '">' . $details['label'] . '</a>'; } echo ' ', implode(' | ', $error_types), ' </td> </tr>'; if ($context['has_filter']) { echo ' <tr> <td colspan="3" class="windowbg"> <strong> ', $txt['applying_filter'], ':</strong> ', $context['filter']['entity'], ' ', $context['filter']['value']['html'], ' [<a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', '">', $txt['clear_filter'], '</a>] </td> </tr>'; } echo ' <tr class="secondary_header"> <td colspan="3" class="righttext" style="padding: 4px 8px;"> <label for="check_all1"><strong>', $txt['check_all'], '</strong></label> <input type="checkbox" id="check_all1" onclick="invertAll(this, this.form, \'delete[]\'); this.form.check_all2.checked = this.checked;" class="input_check" /> </td> </tr>'; // No errors, then show a message if (count($context['errors']) == 0) { echo ' <tr class="windowbg"> <td class="centertext" colspan="2">', $txt['errlog_no_entries'], '</td> </tr>'; } // We have some errors, show them... foreach ($context['errors'] as $error) { echo ' <tr class="windowbg', $error['alternate'] ? '2' : '', '"> <td> <div class="error_who"> <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=id_member;value=', $error['member']['id'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_member'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['apply_filter'], ': ', $txt['filter_only_member'], '" /></a> <strong>', $error['member']['link'], '</strong><br /> <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? '' : ';desc', $context['has_filter'] ? $context['filter']['href'] : '', '" title="', $txt['reverse_direction'], '"><img src="', $settings['images_url'], '/sort_', $context['sort_direction'], '.png" alt="', $txt['reverse_direction'], '" /></a> ', $error['time'], '<br /> <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=ip;value=', $error['member']['ip'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_ip'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['apply_filter'], ': ', $txt['filter_only_ip'], '" /></a> <strong><a href="', $scripturl, '?action=trackip;searchip=', $error['member']['ip'], '">', $error['member']['ip'], '</a></strong> <br /> </div> <div class="error_type">'; if ($error['member']['session'] != '') { echo ' <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=session;value=', $error['member']['session'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_session'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['apply_filter'], ': ', $txt['filter_only_session'], '" /></a> ', $error['member']['session'], '<br /> <a href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=error_type;value=', $error['error_type']['type'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_type'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['apply_filter'], ': ', $txt['filter_only_type'], '" /></a> ', $txt['error_type'], ': ', $error['error_type']['name'], '<br /> <a style="display: table-cell; padding: 4px 0; width: 20px; vertical-align: top;" href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=message;value=', $error['message']['href'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_message'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['apply_filter'], ': ', $txt['filter_only_message'], '" /></a> <span style="display: table-cell;">', $error['message']['html'], '</span>'; } echo ' </div> <div class="error_where"> <a class="scope" href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=url;value=', $error['url']['href'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_url'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['apply_filter'], ': ', $txt['filter_only_url'], '" /></a> <a style="display: table-cell;" href="', $error['url']['html'], '">', $error['url']['html'], '</a> </div>'; if (!empty($error['file'])) { echo ' <div class="error_where"> <a class="scope" href="', $scripturl, '?action=admin;area=logs;sa=errorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=file;value=', $error['file']['search'], '" title="', $txt['apply_filter'], ': ', $txt['filter_only_file'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['apply_filter'], ': ', $txt['filter_only_file'], '" /></a> <div style="display: table-cell;"> ', $txt['file'], ': ', $error['file']['link'], '<br /> ', $txt['line'], ': ', $error['file']['line'], ' </div> </div>'; } echo ' </td> <td class="checkbox_column"> <input type="checkbox" name="delete[]" value="', $error['id'], '" class="input_check" /> </td> <td></td> </tr>'; } echo ' <tr class="secondary_header"> <td colspan="3" class="righttext" style="padding-right: 1.2ex"> <label for="check_all2"><strong>', $txt['check_all'], '</strong></label> <input type="checkbox" id="check_all2" onclick="invertAll(this, this.form, \'delete[]\'); this.form.check_all1.checked = this.checked;" class="input_check" /> </td> </tr> </table> <div class="flow_auto"> <div class="floatleft">'; template_pagesection(); echo ' </div> <div class="additional_row floatright"> <input type="submit" name="removeSelection" value="' . $txt['remove_selection'] . '" onclick="return confirm(\'' . $txt['remove_selection_confirm'] . '\');" class="button_submit" /> <input type="submit" name="delall" value="', $context['has_filter'] ? $txt['remove_filtered_results'] : $txt['remove_all'], '" onclick="return confirm(\'', $context['has_filter'] ? $txt['remove_filtered_results_confirm'] : $txt['sure_about_errorlog_remove'], '\');" class="button_submit" /> </div> </div>'; if ($context['sort_direction'] == 'down') { echo ' <input type="hidden" name="desc" value="1" />'; } echo ' <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['admin-el_token_var'], '" value="', $context['admin-el_token'], '" /> </form>'; }
/** * Close up the who's online page */ function template_whos_selection_below() { global $context, $txt; $extra = ' <div class="selectbox floatright"><label for="show">' . $txt['who_show1'] . '</label> <select name="show" id="show" onchange="document.forms.whoFilter.submit();">'; foreach ($context['show_methods'] as $value => $label) { $extra .= ' <option value="' . $value . '" ' . ($value == $context['show_by'] ? ' selected="selected"' : '') . '>' . $label . '</option>'; } $extra .= ' </select> <noscript> <input type="submit" name="submit_top" value="' . $txt['go'] . '" class="button_submit submitgo" /> </noscript> </div>'; template_pagesection(false, false, array('extra' => $extra)); echo ' </form> </div>'; }
/** * Displays the bad behavior 'hit' log */ function template_badbehavior_log() { global $context, $settings, $scripturl, $txt; echo ' <form class="generic_list_wrapper" action="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';start=', $context['start'], $context['has_filter'] ? $context['filter']['href'] : '', '" method="post" accept-charset="UTF-8"> <h3 class="category_header"> <a class="hdicon cat_img_helptopics help" href="', $scripturl, '?action=quickhelp;help=badbehaviorlog" onclick="return reqOverlayDiv(this.href);" title="', $txt['help'], '"></a> ', $txt['badbehaviorlog_log'], ' </h3> ', template_pagesection(), ' <table class="table_grid" id="error_log">'; if ($context['has_filter']) { echo ' <tr> <td colspan="3" class="windowbg"> <strong> ', $txt['badbehaviorlog_applying_filter'], ':</strong> ', $context['filter']['entity'], ' ', $context['filter']['value']['html'], ' [<a href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', '">', $txt['badbehaviorlog_clear_filter'], '</a>] </td> </tr>'; } // The checkall box echo ' <tr class="secondary_header"> <td colspan="3" class="righttext"> <label for="check_all_1"><strong>', $txt['check_all'], '</strong></label> <input type="checkbox" id="check_all_1" onclick="invertAll(this, this.form, \'delete[]\'); this.form.check_all_2.checked = this.checked;" class="input_check" /> </td> </tr>'; // No log entries, then show a message if (count($context['bb_entries']) == 0) { echo ' <tr class="windowbg"> <td class="centertext" colspan="2">', $txt['badbehaviorlog_no_entries_found'], '</td> </tr>'; } // We have some log entries, maybe even some spammers $i = 0; foreach ($context['bb_entries'] as $entries) { $i++; echo ' <tr class="windowbg', $entries['alternate'] ? '2' : '', '"> <td> <div class="error_who"> <a href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=id_member;value=', $entries['member']['id'], '" title="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_member'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_member'], '" /></a> <strong>', $entries['member']['link'], '</strong><br /> <a href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? '' : ';desc', $context['has_filter'] ? $context['filter']['href'] : '', '" title="', $txt['badbehaviorlog_reverse_direction'], '"><img src="', $settings['images_url'], '/sort_', $context['sort_direction'], '.png" alt="', $txt['badbehaviorlog_reverse_direction'], '" /></a> ', $entries['time'], '<br /> <a href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=ip;value=', $entries['member']['ip'], '" title="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_ip'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_ip'], '" /></a> <strong><a href="', $scripturl, '?action=trackip;searchip=', $entries['member']['ip'], '">', $entries['member']['ip'], '</a></strong> <br /> </div> <div class="error_type">'; if ($entries['member']['session'] !== '') { echo ' <a href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=session;value=', $entries['member']['session'], '" title="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_session'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_session'], '" /></a>', $entries['member']['session'], '<br />'; } echo ' <a href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=valid;value=', $entries['valid']['code'], '" title="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_type'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_type'], '" /></a>', $txt['badbehaviorlog_error_valid_response'], ': ', $entries['valid']['response'], '<br /> <a href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=valid;value=', $entries['valid']['code'], '" title="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_type'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_type'], '" /></a>', $txt['badbehaviorlog_error_valid_log'], ': ', $entries['valid']['log'], '<br /> <a class="bbfilter" href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=request_uri;value=', $entries['request_uri']['href'], '" title="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_headers'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_headers'], '" /></a><a class="bbrequest_uri" href="', $entries['request_uri']['html'], '">', $entries['request_uri']['html'], '</a> </div> <div class="error_where"> <a class="scope" href="', $scripturl, '?action=admin;area=logs;sa=badbehaviorlog', $context['sort_direction'] == 'down' ? ';desc' : '', ';filter=user_agent;value=', $entries['user_agent']['href'], '" title="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_agent'], '"><img src="', $settings['images_url'], '/filter.png" alt="', $txt['badbehaviorlog_apply_filter'], ': ', $txt['badbehaviorlog_filter_only_agent'], '" /></a><span class="bbrequest_uri">', $entries['user_agent']['html'], '</span> </div> <div class="error_where"> <a onclick="expandCollapse(\'details', $i, '\', \'icon', $i, '\'); return false;"> <img id="icon', $i, '" src="', $settings['images_url'], '/selected.png" alt="*" /> <strong>', $txt['badbehaviorlog_details'], '</strong></a><div id="details', $i, '" class="padding" style="display: none">', $entries['http_headers']['html'], '</div> </div> </td> <td class="checkbox_column"> <input type="checkbox" name="delete[]" value="', $entries['id'], '" class="input_check" /> </td> </tr>'; } echo ' <tr class="secondary_header"> <td colspan="3" class="righttext"> <label for="check_all_2"><strong>', $txt['check_all'], '</strong></label> <input type="checkbox" id="check_all_2" onclick="invertAll(this, this.form, \'delete[]\'); this.form.check_all_1.checked = this.checked;" class="input_check" /> </td> </tr> </table> <div class="flow_auto"> <div class="floatleft">'; template_pagesection(); echo ' </div> <div class="additional_row floatright"> <input type="submit" name="removeSelection" value="' . $txt['badbehaviorlog_remove_selection'] . '" onclick="return confirm(\'' . $txt['badbehaviorlog_remove_selection_confirm'] . '\');" class="button_submit" /> <input type="submit" name="delall" value="', $context['has_filter'] ? $txt['badbehaviorlog_remove_filtered_results'] : $txt['remove_all'], '" onclick="return confirm(\'', $context['has_filter'] ? $txt['badbehaviorlog_remove_filtered_results_confirm'] : $txt['badbehaviorlog_sure_remove'], '\');" class="button_submit" /> </div> </div>'; if ($context['sort_direction'] == 'down') { echo ' <input type="hidden" name="desc" value="1" />'; } echo ' <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="', $context['admin-bbl_token_var'], '" value="', $context['admin-bbl_token'], '" /> </form>'; }
/** * Template for showing all the posts of the user, in chronological order. */ function template_action_showPosts() { global $context, $txt; echo ' <div id="profilecenter"> <h2 class="category_header"> ', empty($context['is_topics']) ? $txt['showMessages'] : $txt['showTopics'], $context['user']['is_owner'] ? '' : ' - ' . $context['member']['name'], ' </h2>'; template_pagesection(); // No posts? Just end the table with a informative message. if (empty($context['posts'])) { echo ' <div class="windowbg2"> <div class="content"> ', $context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none'], ' </div> </div>'; } else { // For every post to be displayed, give it its own div, and show the important details of the post. foreach ($context['posts'] as $post) { $post['title'] = '<strong>' . $post['board']['link'] . ' / ' . $post['topic']['link'] . '</strong>'; $post['date'] = $post['html_time']; $post['class'] = $post['alternate'] === 0 ? 'windowbg2' : 'windowbg'; if (!$post['approved']) { $post['body'] = ' <div class="approve_post"> <em>' . $txt['post_awaiting_approval'] . '</em> </div>' . ' ' . $post['body']; } template_simple_message($post); } } // Show more page numbers. template_pagesection(); echo ' </div>'; }
/** * Interface to allow selection of messages to split. */ function template_select() { global $context, $settings, $txt, $scripturl; echo ' <div id="split_topics"> <form action="', $scripturl, '?action=splittopics;sa=splitSelection;board=', $context['current_board'], '.0" method="post" accept-charset="UTF-8"> <div class="content"> <div id="not_selected" class="floatleft"> <h2 class="category_header">', $txt['split_topic'], ' - ', $txt['select_split_posts'], '</h2> <div class="information"> ', $txt['please_select_split'], ' </div>', template_pagesection(false, false, array('page_index_markup' => $context['not_selected']['page_index'], 'page_index_id' => 'pageindex_not_selected')), ' <ul id="messages_not_selected" class="split_messages smalltext">'; foreach ($context['not_selected']['messages'] as $message) { echo ' <li class="windowbg', $message['alternate'] ? '2' : '', '" id="not_selected_', $message['id'], '"> <div class="content"> <div class="message_header"> <a class="split_icon floatright" href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=down;msg=', $message['id'], '" onclick="return topicSplitselect(\'down\', ', $message['id'], ');"><i class="fa fa-2x fa-arrow-circle-o-right"></i></a> <strong>', $message['subject'], '</strong> ', $txt['by'], ' <strong>', $message['poster'], '</strong><br /> <em>', $message['time'], '</em> </div> <div class="post">', $message['body'], '</div> </div> </li>'; } echo ' <li class="dummy"></li> </ul> </div> <div id="selected" class="floatright"> <h3 class="category_header"> ', $txt['split_selected_posts'], '<a class="linkbutton floatright" href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=reset;msg=0" onclick="return topicSplitselect(\'reset\', 0);">', $txt['split_reset_selection'], '</a> </h3> <div class="information"> ', $txt['split_selected_posts_desc'], ' </div>', template_pagesection(false, false, array('page_index_markup' => $context['selected']['page_index'], 'page_index_id' => 'pageindex_selected')), ' <ul id="messages_selected" class="split_messages smalltext">'; if (!empty($context['selected']['messages'])) { foreach ($context['selected']['messages'] as $message) { echo ' <li class="windowbg', $message['alternate'] ? '2' : '', '" id="selected_', $message['id'], '"> <div class="content"> <div class="message_header"> <a class="split_icon floatleft" href="', $scripturl, '?action=splittopics;sa=selectTopics;subname=', $context['topic']['subject'], ';topic=', $context['topic']['id'], '.', $context['not_selected']['start'], ';start2=', $context['selected']['start'], ';move=up;msg=', $message['id'], '" onclick="return topicSplitselect(\'up\', ', $message['id'], ');"><i class="fa fa-2x fa-arrow-circle-o-left"></i></a> <strong>', $message['subject'], '</strong> ', $txt['by'], ' <strong>', $message['poster'], '</strong><br /> <em>', $message['time'], '</em> </div> <div class="post">', $message['body'], '</div> </div> </li>'; } } echo ' <li class="dummy"></li> </ul> </div> <div class="submitbutton clear_right"> <input type="hidden" name="topic" value="', $context['current_topic'], '" /> <input type="submit" value="', $txt['split_topic'], '" class="button_submit" /> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> </div> </div> </form> </div> <script><!-- // --><![CDATA[ var start = [], topic_subject = "', $context['topic']['subject'], '", topic_id = "', $context['topic']['id'], '", not_selected_start = "', $context['not_selected']['start'], '", selected_start = "', $context['selected']['start'], '", images_url = "', $settings['images_url'], '", txt_by = "', $txt['by'], '"; start[0] = ', $context['not_selected']['start'], '; start[1] = ', $context['selected']['start'], '; // ]]></script>'; }
/** * Board Block, Displays a list of posts from selected board(s) * * @param mixed[] $parameters * 'board' => Board(s) to select posts from * 'limit' => max number of posts to show * 'start' => id of post to start from * 'length' => preview length of the post * 'avatar' => show the poster avatar * 'per_page' => number of posts per page to show * @param int $id - not used in this block * @param boolean $return_parameters if true returns the configuration options for the block */ function sp_boardNews($parameters, $id, $return_parameters = false) { global $scripturl, $txt, $settings, $modSettings, $color_profile; $db = database(); $block_parameters = array('board' => 'boards', 'limit' => 'int', 'start' => 'int', 'length' => 'int', 'avatar' => 'check', 'per_page' => 'int'); if ($return_parameters) { return $block_parameters; } // Break out / sanitize all the parameters $board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null; $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; $start = !empty($parameters['start']) ? (int) $parameters['start'] : 0; $length = isset($parameters['length']) ? (int) $parameters['length'] : 250; $avatars = !empty($parameters['avatar']); $per_page = !empty($parameters['per_page']) ? (int) $parameters['per_page'] : 0; $limit = max(0, $limit); $start = max(0, $start); loadLanguage('Stats'); $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless'); $icon_sources = array(); foreach ($stable_icons as $icon) { $icon_sources[$icon] = 'images_url'; } $request = $db->query('', ' SELECT t.id_first_msg FROM {db_prefix}topics AS t INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board) INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg) WHERE {query_see_board} AND ' . (empty($board) ? 't.id_first_msg >= {int:min_msg_id}' : 't.id_board IN ({array_int:current_board})') . ($modSettings['postmod_active'] ? ' AND t.approved = {int:is_approved}' : '') . ' AND (t.locked != {int:locked} OR m.icon != {string:icon}) ORDER BY t.id_first_msg DESC LIMIT {int:limit}', array('current_board' => $board, 'min_msg_id' => $modSettings['maxMsgID'] - 45 * min($limit, 5), 'is_approved' => 1, 'locked' => 1, 'icon' => 'moved', 'limit' => $limit)); $posts = array(); while ($row = $db->fetch_assoc($request)) { $posts[] = $row['id_first_msg']; } $db->free_result($request); if (empty($posts)) { echo ' ', $txt['error_sp_no_posts_found']; return; } elseif (!empty($per_page)) { $limit = count($posts); $start = !empty($_REQUEST['news' . $id]) ? (int) $_REQUEST['news' . $id] : 0; $clean_url = str_replace('%', '%%', preg_replace('~news' . $id . '=[^;]+;?~', '', $_SERVER['REQUEST_URL'])); $current_url = $clean_url . (strpos($clean_url, '?') !== false ? in_array(substr($clean_url, -1), array(';', '?')) ? '' : ';' : '?'); } $request = $db->query('', ' SELECT m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time, t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar, mem.email_address, a.id_attach, a.attachment_type, a.filename, t.num_views FROM {db_prefix}topics AS t INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg) LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) WHERE t.id_first_msg IN ({array_int:post_list}) ORDER BY t.id_first_msg DESC LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}', array('post_list' => $posts, 'start' => $start, 'limit' => !empty($per_page) ? $per_page : $limit)); $return = array(); $colorids = array(); while ($row = $db->fetch_assoc($request)) { // Using the cutoff tag? $limited = false; if (($cutoff = Util::strpos($row['body'], '[cutoff]')) !== false) { require_once SUBSDIR . '/Post.subs.php'; $row['body'] = Util::substr($row['body'], 0, $cutoff); preparsecode($row['body']); $limited = true; } // Good time to do this is ... now censorText($row['subject']); censorText($row['body']); $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']); // Shorten the text, link the ellipsis, etc as needed if ($limited || !empty($length)) { $ellip = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">…</a>'; $row['body'] = $limited ? $row['body'] . $ellip : Util::shorten_html($row['body'], $length, $ellip, false); } if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']])) { $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url'; } if ($modSettings['sp_resize_images']) { $row['body'] = str_ireplace('class="bbc_img', 'class="bbc_img sp_article', $row['body']); } if (!empty($row['id_member'])) { $colorids[$row['id_member']] = $row['id_member']; } // Build an array of message information for output $return[] = array('id' => $row['id_topic'], 'message_id' => $row['id_msg'], 'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.png" class="icon" alt="' . $row['icon'] . '" />', 'subject' => $row['subject'], 'time' => standardTime($row['poster_time']), 'views' => $row['num_views'], 'body' => $row['body'], 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0', 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $txt['sp_read_more'] . '</a>', 'replies' => $row['num_replies'], 'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'], 'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>', 'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>', 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '', 'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name']), 'locked' => !empty($row['locked']), 'is_last' => false, 'avatar' => determineAvatar(array('avatar' => $row['avatar'], 'filename' => $row['filename'], 'id_attach' => $row['id_attach'], 'email_address' => $row['email_address'], 'attachment_type' => $row['attachment_type']))); } $db->free_result($request); // Nothing found, say so and exit if (empty($return)) { echo ' ', $txt['error_sp_no_posts_found']; return; } $return[count($return) - 1]['is_last'] = true; // If we want color id's then lets add them in if (!empty($colorids) && sp_loadColors($colorids) !== false) { foreach ($return as $k => $p) { if (!empty($color_profile[$p['poster']['id']]['link'])) { $return[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link']; } } } // Auto video embedding enabled? if (!empty($modSettings['enableVideoEmbeding'])) { addInlineJavascript(' $(document).ready(function() { $().linkifyvideo(oEmbedtext); });', true); } // Output all the details we have found foreach ($return as $news) { echo ' <h3 class="category_header"> <span class="floatleft sp_article_icon">', $news['icon'], '</span><a href="', $news['href'], '" >', $news['subject'], '</a> </h3> <div id="msg_', $news['message_id'], '" class="sp_article_content"> <div class="sp_content_padding">'; if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href'])) { echo ' <a href="', $scripturl, '?action=profile;u=', $news['poster']['id'], '"> <img src="', $news['avatar']['href'], '" alt="', $news['poster']['name'], '" style="max-width:40px" class="floatright" /> </a> <div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>'; } else { echo ' <div class="middletext">', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '</div>'; } echo ' <div class="post"><hr />', $news['body'], '</div> <div class="righttext">', $news['link'], ' ', $news['new_comment'], '</div> </div> </div>'; } // Pagenation is a good thing if (!empty($per_page)) { global $context; $context['page_index'] = constructPageIndex($current_url . 'news' . $id . '=%1$d', $start, $limit, $per_page, true); echo ' <div class="sp_page_index">', template_pagesection(), ' </div>'; } }
/** * Used to display items below the page, like page navigation */ function template_pages_and_buttons_below() { global $context, $txt; // Show the page index... "Pages: [1]". template_pagesection('normal_buttons', 'right'); // Show the lower breadcrumbs. theme_linktree(); if (can_see_button_strip($context['mod_buttons'])) { echo ' <i class="fa fa-2x fa-bars hamburger_30" data-id="moderationbuttons"></i>'; } echo ' <div id="moderationbuttons" class="hide_30 hamburger_30_target">', template_button_strip($context['mod_buttons'], 'bottom', array('id' => 'moderationbuttons_strip')), '</div>'; // Show the jump-to box, or actually...let Javascript do it. echo ' <div id="display_jump_to"> </div> <script><!-- // --><![CDATA[ aJumpTo[aJumpTo.length] = new JumpTo({ sContainerId: "display_jump_to", sJumpToTemplate: "<label class=\\"smalltext\\" for=\\"%select_id%\\">', $context['jump_to']['label'], ':<" + "/label> %dropdown_list%", iCurBoardId: ', $context['current_board'], ', iCurBoardChildLevel: ', $context['jump_to']['child_level'], ', sCurBoardName: "', $context['jump_to']['board_name'], '", sBoardChildLevelIndicator: " ", sBoardPrefix: "', isBrowser('ie8') ? '» ' : '➤ ', '", sCatClass: "jump_to_header", sCatPrefix: "", sGoButtonLabel: "', $txt['go'], '" }); // ]]></script>'; // Tooltips for likes echo ' <script><!-- // --><![CDATA[ $(".like_button, .unlike_button, .likes_button").SiteTooltip({hoverIntent: {sensitivity: 10, interval: 150, timeout: 50}}); // ]]></script>'; }
/** * Interface to show unread replies to your posts. */ function template_replies() { global $context, $txt, $scripturl; $message_icon_sprite = array('clip' => '', 'lamp' => '', 'poll' => '', 'question' => '', 'xx' => '', 'moved' => '', 'exclamation' => '', 'thumbup' => '', 'thumbdown' => ''); if (!empty($context['topics'])) { template_pagesection('recent_buttons', 'right'); if ($context['showCheckboxes']) { echo ' <form action="', $scripturl, '?action=quickmod" method="post" accept-charset="UTF-8" name="quickModForm" id="quickModForm" style="margin: 0;"> <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> <input type="hidden" name="qaction" value="markread" /> <input type="hidden" name="redirect_url" value="action=unreadreplies', !empty($context['showing_all_topics']) ? ';all' : '', $context['querystring_board_limits'], '" />'; } // [WIP] There is trial code here to hide the topic icon column. Colspan can be cleaned up later. echo ' <h2 class="category_header" id="unread_header"> ', $txt['unread_replies'], ' </h2> <ul id="sort_by" class="topic_sorting topic_sorting_recent">'; if ($context['showCheckboxes']) { echo ' <li class="listlevel1 quickmod_select_all"> <input type="checkbox" onclick="invertAll(this, document.getElementById(\'quickModForm\'), \'topics[]\');" class="input_check" /> </li>'; } $current_header = $context['topics_headers'][$context['sort_by']]; echo ' <li class="listlevel1 topic_sorting_row"> <a class="sort topicicon img_sort', $context['sort_direction'], '" href="', $current_header['url'], '" title="', $context['sort_title'], '"></a> </li>'; echo ' <li class="listlevel1 topic_sorting_row">', $txt['sort_by'], ': <a href="', $current_header['url'], '">', $txt[$context['sort_by']], '</a> <ul class="menulevel2" id="sortby">'; foreach ($context['topics_headers'] as $key => $value) { echo ' <li class="listlevel2 sort_by_item" id="sort_by_item_', $key, '"><a href="', $value['url'], '" class="linklevel2">', $txt[$key], ' ', $value['sort_dir_img'], '</a></li>'; } echo ' </ul>'; // Show a "select all" box for quick moderation? echo ' </li> </ul> <ul class="topic_listing" id="unread">'; foreach ($context['topics'] as $topic) { // Calculate the color class of the topic. if ($topic['is_sticky'] && $topic['is_locked']) { $color_class = 'locked_row sticky_row'; } elseif ($topic['is_sticky']) { $color_class = 'sticky_row'; } elseif ($topic['is_locked']) { $color_class = 'locked_row'; } else { $color_class = 'basic_row'; } echo ' <li class="', $color_class, '"> <div class="topic_info"> <p class="topic_icons', isset($message_icon_sprite[$topic['first_post']['icon']]) ? ' topicicon img_' . $topic['first_post']['icon'] : '', '">'; if (!isset($message_icon_sprite[$topic['first_post']['icon']])) { echo ' <img src="', $topic['first_post']['icon_url'], '" alt="" />'; } echo ' ', $topic['is_posted_in'] ? '<span class="fred topicicon img_profile"></span>' : '', ' </p> <div class="topic_name">'; // The new icons look better if they aren't all over the page. echo ' <h4> <a class="new_posts" href="', $topic['new_href'], '" id="newicon', $topic['first_post']['id'], '">' . $txt['new'] . '</a> ', $topic['is_sticky'] ? '<strong>' : '', '<span class="preview" title="', $topic['default_preview'], '"><span id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span></span>', $topic['is_sticky'] ? '</strong>' : '', ' </h4> </div> <div class="topic_starter"> ', $topic['first_post']['started_by'], !empty($topic['pages']) ? ' <ul class="small_pagelinks" id="pages' . $topic['first_post']['id'] . '" role="menubar">' . $topic['pages'] . '</ul>' : '', ' </div> </div> <div class="topic_latest"> <p class="topic_stats"> ', $topic['replies'], ' ', $txt['replies'], ' <br /> ', $topic['views'], ' ', $txt['views'], ' </p> <p class="topic_lastpost"> <a class="topicicon img_last_post" href="', $topic['last_post']['href'], ' title="', $txt['last_post'], '"></a> ', $topic['last_post']['html_time'], '<br /> ', $txt['by'], ' ', $topic['last_post']['member']['link'], ' </p> </div>'; if ($context['showCheckboxes']) { echo ' <p class="topic_moderation"> <input type="checkbox" name="topics[]" value="', $topic['id'], '" class="input_check" /> </p>'; } echo ' </li>'; } echo ' </ul>'; if ($context['showCheckboxes']) { echo ' </form>'; } template_pagesection('recent_buttons', 'right'); echo ' <div id="topic_icons" class="description">', template_basicicons_legend(), ' </div>'; } else { echo ' <div class="forum_category"> <h2 class="category_header"> ', $txt['topic_alert_none'], ' </h2> <div class="board_row centertext"> ', $context['showing_all_topics'] ? '<strong>' . $txt['find_no_results'] . '</strong>' : $txt['unread_topics_visit_none'], ' </div> </div>'; } }