📄 topic.php
字号:
if ( !$new_post_anchor_set && $previous_view < $postsdata['post_time'] ) { $new_post_anchor = '<a name="newpost"></a>'; $new_post_anchor_set = true; } else { $new_post_anchor = ''; } } else { $new_post_anchor = ''; } // // This poster was logged in // if ( !empty($postsdata['poster_id']) ) { // // Its name and profile link // $poster_name = $functions->make_profile_link($postsdata['poster_id'], $postsdata['poster_name'], $postsdata['poster_level']); // // Its rank // If he has a custom rank, use it, otherwise use the level information // if ( !empty($postsdata['rank']) ) { $poster_rank = unhtml(stripslashes($postsdata['rank'])); } else { switch ( $postsdata['poster_level'] ) { case 3: $poster_rank = $lang['Administrator']; break; case 2: $poster_rank = $lang['Moderator']; break; case 1: $poster_rank = $lang['Member']; break; } } // // User's avatar // if ( $functions->get_config('hide_avatars') || !$postsdata['avatar_type'] ) { $avatar = ''; } elseif ( intval($postsdata['avatar_type']) === 1 ) { $avatar_force_width = ( $functions->get_config('avatars_force_width') ) ? ' width="'.intval($functions->get_config('avatars_force_width')).'"' : ''; $avatar_force_height = ( $functions->get_config('avatars_force_height') ) ? ' height="'.intval($functions->get_config('avatars_force_height')).'"' : ''; $avatar = '<img src="'.$postsdata['avatar_remote'].'" alt=""'.$avatar_force_width.$avatar_force_height.' />'; } } else { // // The poster was a guest // $poster_name = unhtml(stripslashes($postsdata['poster_guest'])); $poster_rank = $lang['Guest']; $avatar = ''; } $post_topic_title = ( ( $i ) ? $lang['Re'].' ' : '' ) . $topic_title; // // Links used to control posts: quote, edit, delete... // $post_links = array(); if ( $session->sess_info['user_id'] && ( $postsdata['poster_id'] == $session->sess_info['user_id'] || $functions->auth($topicdata['auth'], 'edit', $topicdata['forum_id']) ) && $postsdata['poster_level'] <= $session->sess_info['user_info']['level'] ) $post_links[] = '<a href="'.$functions->make_url('edit.php', array('post' => $postsdata['id'])).'">'.$lang['Edit'].'</a>'; if ( $session->sess_info['user_id'] && ( ( $postsdata['poster_id'] == $session->sess_info['user_id'] && $topicdata['last_post_id'] == $postsdata['id'] ) || $functions->auth($topicdata['auth'], 'delete', $topicdata['forum_id']) ) && $postsdata['poster_level'] <= $session->sess_info['user_info']['level'] ) $post_links[] = '<a href="'.$functions->make_url('edit.php', array('post' => $postsdata['id'], 'act' => 'delete')).'">'.$lang['Delete'].'</a>'; if ( ( !$topicdata['status_locked'] || $functions->auth($topicdata['auth'], 'lock', $topicdata['forum_id']) ) && ( $topicdata['forum_status'] || $functions->get_user_level() == LEVEL_ADMIN ) && $functions->auth($topicdata['auth'], 'reply', $topicdata['forum_id']) ) $post_links[] = '<a href="'.$functions->make_url('post.php', array('topic' => $requested_topic, 'quotepost' => $postsdata['id'])).'" rel="nofollow">'.$lang['Quote'].'</a>'; if ( count($post_links) ) $post_links = join($template->get_config('postlinks_item_delimiter'), $post_links); else $post_links = ''; if ( $postsdata['post_edit_time'] && ( $postsdata['post_edit_time'] > ( $postsdata['post_time'] + intval($functions->get_config('show_edited_message_timeout')) ) ) ) { if ( $postsdata['post_edit_by'] === $postsdata['poster_id'] ) { $editer_info = $postsdata; } else { $result2 = $db->query("SELECT displayed_name AS poster_name, level AS poster_level FROM ".TABLE_PREFIX."members WHERE id = ".$postsdata['post_edit_by']); $editer_info = $db->fetch_result($result2); } $post_editby = ( $postsdata['post_edit_by'] ) ? $functions->make_profile_link($postsdata['post_edit_by'], $editer_info['poster_name'], $editer_info['poster_level']) : $lang['Unknown']; $post_editinfo = sprintf($template->get_config('post_editinfo_format'), sprintf($lang['PostEditInfo'], $post_editby, $functions->make_date($postsdata['post_edit_time']))); } else { $post_editinfo = ''; } // // Output the post // $template->parse('post', 'topic', array( 'poster_name' => $poster_name, 'poster_rank' => $poster_rank, 'poster_avatar' => $avatar, 'posts' => ( !empty($postsdata['poster_id']) && !$functions->get_config('hide_userinfo') ) ? $lang['Posts'].': '.$postsdata['posts'] : '', 'registered' => ( !empty($postsdata['poster_id']) && !$functions->get_config('hide_userinfo') ) ? $lang['Registered'].': '.$functions->make_date($postsdata['regdate'], 'M y') : '', 'location' => ( !empty($postsdata['poster_id']) && !empty($postsdata['location']) && !$functions->get_config('hide_userinfo') ) ? $lang['Location'].': '.unhtml(stripslashes($postsdata['location'])) : '', 'topic_title' => $post_topic_title, 'post_anchor' => '<a href="'.$functions->make_url('topic.php', array('post' => $postsdata['id'])).'#post'.$postsdata['id'].'" name="post'.$postsdata['id'].'" rel="nofollow">#'.$i.'</a>'.$new_post_anchor, 'post_date' => $functions->make_date($postsdata['post_time']), 'post_links' => $post_links, 'post_content' => $functions->markup($functions->replace_badwords(stripslashes($postsdata['content'])), $postsdata['enable_bbcode'], $postsdata['enable_smilies'], $postsdata['enable_html']), 'poster_sig' => ( !$functions->get_config('hide_signatures') && !empty($postsdata['signature']) && $postsdata['enable_sig'] ) ? sprintf($template->get_config('sig_format'), $functions->markup($functions->replace_badwords(stripslashes($postsdata['signature'])), $functions->get_config('sig_allow_bbcode'), $functions->get_config('sig_allow_smilies'))) : '', 'post_editinfo' => $post_editinfo, 'poster_ip_addr' => ( !empty($postsdata['poster_ip_addr']) && $functions->get_user_level() == LEVEL_ADMIN ) ? sprintf($template->get_config('poster_ip_addr_format'), sprintf($lang['ViewingIP'], '<a href="'.$functions->make_url('admin.php', array('act' => 'iplookup', 'ip' => $postsdata['poster_ip_addr'])).'">'.$postsdata['poster_ip_addr'].'</a>')) : '', 'colornum' => $colornum )); } // // Links for controlling topics: delete, move, lock, sticky... // $action_links = array(); if ( $session->sess_info['user_id'] ) { if ( !$subscribed ) $action_links[] = '<a href="'.$functions->make_url('topic.php', array('id' => $requested_topic, 'act' => 'subscribe')).'">'.$lang['SubscribeTopic'].'</a>'; else $action_links[] = '<a href="'.$functions->make_url('topic.php', array('id' => $requested_topic, 'act' => 'unsubscribe')).'">'.$lang['UnsubscribeTopic'].'</a>'; } if ( $functions->auth($topicdata['auth'], 'delete', $topicdata['forum_id']) ) $action_links[] = '<a href="'.$functions->make_url('edit.php', array('topic' => $requested_topic, 'act' => 'delete')).'">'.$lang['DeleteTopic'].'</a>'; if ( $functions->auth($topicdata['auth'], 'move', $topicdata['forum_id']) && intval($functions->get_stats('viewable_forums')) > 1 ) $action_links[] = '<a href="'.$functions->make_url('edit.php', array('topic' => $requested_topic, 'act' => 'move')).'">'.$lang['MoveTopic'].'</a>'; if ( $functions->auth($topicdata['auth'], 'lock', $topicdata['forum_id']) ) { if ( $topicdata['status_locked'] ) $action_links[] = '<a href="'.$functions->make_url('edit.php', array('topic' => $requested_topic, 'act' => 'unlock')).'">'.$lang['UnlockTopic'].'</a>'; else $action_links[] = '<a href="'.$functions->make_url('edit.php', array('topic' => $requested_topic, 'act' => 'lock')).'">'.$lang['LockTopic'].'</a>'; } if ( $functions->auth($topicdata['auth'], 'sticky', $topicdata['forum_id']) ) { if ( $topicdata['status_sticky'] ) $action_links[] = '<a href="'.$functions->make_url('edit.php', array('topic' => $requested_topic, 'act' => 'unsticky')).'">'.$lang['MakeNormalTopic'].'</a>'; else $action_links[] = '<a href="'.$functions->make_url('edit.php', array('topic' => $requested_topic, 'act' => 'sticky')).'">'.$lang['MakeSticky'].'</a>'; } $action_links = join($template->get_config('item_delimiter'), $action_links); $template->parse('footer', 'topic', array( 'new_topic_link' => $new_topic_link, 'reply_link' => $reply_link, 'page_links' => $page_links, 'action_links' => $action_links )); // // Neat feature: the quick reply // Only shown if enabled, if user can reply and if user can post in lcoked forum... // if ( $functions->get_config('enable_quickreply') && ( !$topicdata['status_locked'] || $functions->auth($topicdata['auth'], 'lock', $topicdata['forum_id']) ) && ( $topicdata['forum_status'] || $functions->get_user_level() == LEVEL_ADMIN ) && $functions->auth($topicdata['auth'], 'reply', $topicdata['forum_id']) ) { // // Get session saved guest's username if there is one // $username = ( !$session->sess_info['user_id'] && !empty($_SESSION['user']) ) ? unhtml(stripslashes($_SESSION['user'])) : ''; $subscribe_topic = ( $session->sess_info['user_id'] && $session->sess_info['user_info']['auto_subscribe_reply'] ) ? 1 : 0; $template->parse('quick_reply', 'topic', array( 'form_begin' => '<form action="'.$functions->make_url('post.php', array('topic' => $requested_topic)).'" method="post">', 'username_input' => ( $session->sess_info['user_id'] ) ? '<a href="'.$functions->make_url('profile.php', array('id' => $session->sess_info['user_info']['id'])).'">'.unhtml(stripslashes($session->sess_info['user_info']['displayed_name'])).'</a>' : '<input type="text" size="25" maxlength="'.$functions->get_config('username_max_length').'" name="user" value="'.$username.'" />', 'content_input' => '<textarea rows="'.$template->get_config('quick_reply_textarea_rows').'" cols="'.$template->get_config('textarea_cols').'" name="content"></textarea>', 'submit_button' => '<input type="submit" name="submit" value="'.$lang['OK'].'" /><input type="hidden" name="enable_bbcode" value="1" /><input type="hidden" name="enable_smilies" value="1" /><input type="hidden" name="enable_sig" value="1" /><input type="hidden" name="subscribe_topic" value="'.$subscribe_topic.'" />', 'preview_button' => '<input type="submit" name="preview" value="'.$lang['Preview'].'" />', 'reset_button' => '<input type="reset" value="'.$lang['Reset'].'" />', 'form_end' => '</form>' )); } $_SESSION['viewed_topics'][$requested_topic] = time(); } else { // // The user is not granted to view this topic // $functions->redir_to_login(); } } // // Include the page footer // require(ROOT_PATH.'sources/page_foot.php'); } else { // // There's no forum ID! Get us back to the index... // $functions->redirect('index.php'); }?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -