function render_segment_summary($dbc, $row) { $segment_title = $row[title]; $segment_id = $row[id]; $segment_content = tcmks_substr($row[content]); echo "<h4>"; $articles = get_articles_by_seg($dbc, $segment_id, false); if (count($articles) != 0) { echo render_articles_by_seg($dbc, $segment_id, false); echo " / "; echo "<a target=\"_blank\" href = \"article.php?view&id=" . $articles[0] . "#s{$segment_id}\">" . $segment_title . "</a>"; } else { echo "<a target=\"_blank\" href = \"segment.php?id={$segment_id}\">" . $segment_title . "</a>"; } echo "</h4>"; render_user_action($dbc, $row[user_id], '创建于', $row[create_time]); echo "<p>" . $segment_content . "...</p>"; }
$c_content = $row2['content']; $c_rank = $row2['rank']; $c_creator = $row2['user_id']; $c_create_time = $row2['create_time']; if (!$has_right_to_edit && $row2['is_comment']) { continue; } echo '<section id="s' . $segment_id . '">'; $is_comment = $row2['is_comment'] ? '批注:' : ''; if ($c_rank == 0) { echo '<p><strong><font face="微软雅黑">' . $is_comment . $c_title . '</font></strong></p>'; } else { $c_rank_no = $c_rank + 2; echo '<h' . $c_rank_no . '><font face="微软雅黑">' . $is_comment . $c_title . '</font></h' . $c_rank_no . '>'; } render_user_action($dbc, $c_creator, '创建于', $c_create_time); echo ($tags_string = render_tags($dbc, $c_id)) ? '<p>标签:' . $tags_string . '</p>' : ''; //echo '<p>' . $c_content . '</p>'; //$c_content_processed = process_number_sign($c_content); //echo '<p>' . $c_content_processed["content"] . '</p>'; //$results = process_number_sign($c_content); //$biblio = array_merge($biblio, $results[biblio]); preg_match_all('/#(.*?)#/', $c_content, $out); foreach ($out[1] as $word) { if (!strncmp($word, BIBLIO, strlen(BIBLIO))) { $word = substr($word, strlen(BIBLIO)); //echo "is biblio;"; if (in_array($word, $biblio)) { $key = array_search($word, $biblio) + 1; //print_r($biblio); //echo $word." is array search as:" . $key ."; ";
<?php include_once "./header.php"; include_once "./users_helper.php"; if (isset($_GET['id'])) { $segment_id = $_GET['id']; $query = "SELECT * FROM segment WHERE id ='{$segment_id}'"; $result = mysqli_query($dbc, $query) or die('Error querying database2.'); while ($row = mysqli_fetch_array($result)) { echo '<div class="container">'; echo '<h1><font face="微软雅黑" >' . $row[title] . '</font> '; if (is_segment_editable($dbc, $segment_id)) { echo '<a class="btn btn-success" href="editor.php?act=edit&id=' . $segment_id . '"><i class="icon-edit icon-white"></i> 编辑</a>'; } echo ' '; echo '<a class="btn btn-warning" href="search.php"><i class="icon-home icon-white"></i> 返回</a>'; echo '</h1>'; render_user_action($dbc, $row[user_id], '创建于', $row[create_time]); echo '<p>' . $row[content] . '</p>'; echo '</div>'; } } else { echo '无相关信息!'; } include_once "./foot.php";