Ejemplo n.º 1
0
function search_result($result)
{
    global $lastop, $lastopcap;
    $f = new form();
    $f->start("form");
    $f->add_element(array("type" => "submit", "name" => "newsearch", "value" => "<- New Search", "extrahtml" => "alt='Go back and search again' onClick='src_do.value=0'"));
    $f->add_element(array("type" => "submit", "name" => "refresh", "value" => "Refresh", "extrahtml" => "alt=\"Refresh this page\""));
    $f->add_element(array("type" => "hidden", "name" => "key", "value" => "0"));
    $f->show_element("id");
    repeat_search($_POST, $f);
    ?>
	
	<table border=0 cellspacing=0 align=center width=300>
	 <?php 
    if (isset($lastop)) {
        print "<tr><td colspan=3 align=center>" . $lastop . "</td></tr>";
    }
    ?>
	 <tr>
	 	<td align="left" width=33%><?php 
    $f->show_element("newsearch");
    ?>
</td>
	 	<td align="center" width=33%><?php 
    $f->show_element("refresh");
    ?>
</td>
	 	<td align=right ><b>Search Results</b></td></tr>
	 <tr><td colspan=3>
	 <table border="0" cellspacing="1" align=center width="100%" style="border:1px solid #4444ff;">
	  <tr bgcolor=#ddddff>
	  <script language=javascript>
	  	function order(x){
	  		if (document.forms[0].src_order.value!=x)
	  			document.forms[0].src_order.value=x;
	  		else document.forms[0].src_order.value=x+' desc';
	  		document.forms[0].submit();
	  	}
	  </script>
	  	<td><b><a href=# onClick="order('id');">ID</a></b></td>
	  	<td><b><a href=# onClick="order('name');">Name</a></b></td>
	  	<td><b><a href=# onClick="order('s_cscf_uri');">URI</a></b></td>
	  </tr>
	  <script language=javascript>
	  	function edit(i){
	  		document.forms[0].key.value=i;	  		
 			document.forms[0].src_do.value='edit';
	  		document.forms[0].submit();
	  	}
	  </script>
 <?php 
    foreach ($result->data as $k => $v) {
        print "<tr bgcolor=#eeeeff>";
        print "<td align=right>" . $v["id"] . "</td>";
        print "<td align=left><a href=# onClick=\" edit(" . $v["id"] . ");\">" . $v["name"] . "</a></td>";
        print "<td align=left>" . $v["uri"] . "</a></td>";
        print "</tr>";
    }
    ?>
	  <script language=javascript>
	  	function newscscf(){
	  		document.forms[0].src_do.value='new';
	  		document.forms[0].submit();
	  	}
	  </script>
<?php 
    $f->add_element(array("type" => "text", "name" => "new_name", "value" => $_POST["new_name"], "extrahtml" => " size=32"));
    print "<tr bgcolor=#eeeeff><td></td>";
    print "<td bgcolor=#00ff00 colspan=2>";
    $f->show_element("new_name");
    print "&nbsp;&nbsp;";
    print "<input type=button name=\"new\" value=\"new\" onClick=\" newscscf();\"></td>";
    print "</tr>";
    //print_r($result);
    ?>
 	</table>
 	</td><tr>
 	<?php 
    page_navigation($_POST["src_page"], $result->pages);
    $f->finish("", null);
}
Ejemplo n.º 2
0
                if (stripos($topic_headline, $ignored_phrase) !== false || stripos($topic_body, $ignored_phrase) !== false) {
                    // We've encountered an ignored phrase, so skip the rest of this while() iteration.
                    $table->num_rows_fetched++;
                    continue 2;
                }
            }
        }
        // Decide what to use for the last seen marker and the age/last bump column.
        if ($topics_mode) {
            $order_time = $topic_time;
        } else {
            $order_time = $topic_last_post;
        }
        // Process the values for this row of our table.
        $values = array('<a href="/topic/' . $topic_id . '">' . htmlspecialchars($topic_headline) . '</a>', snippet($topic_body), replies($topic_id, $topic_replies), format_number($topic_visits), '<span class="help" title="' . format_date($order_time) . '">' . calculate_age($order_time) . '</span>');
        if ($_COOKIE['spoiler_mode'] != 1) {
            array_splice($values, 1, 1);
        }
        $table->LastSeenMarker($last_seen, $order_time);
        $table->Row($values);
    }
}
$num_rows_fetched = $table->num_rows_fetched;
echo $table->Output('topics');
// Navigate backward or forward ...
$navigation_path = 'topics';
if ($_GET['bumps']) {
    $navigation_path = 'bumps';
}
page_navigation($navigation_path, $current_page, $num_rows_fetched);
require 'includes/footer.php';
Ejemplo n.º 3
0
    $page_title = 'Your post history, page #' . number_format($current_page);
}
$items_per_page = ITEMS_PER_PAGE;
$start_listing_at = $items_per_page * ($current_page - 1);
/* TOPICS */
$res = DB::Execute('SELECT id, time, replies, visits, headline FROM {P}Topics WHERE author = ? ORDER BY id DESC LIMIT ?, ?', array($_SESSION['UID'], $start_listing_at, $items_per_page));
$topics = new TablePrinter('tblTopics');
$columns = array('Headline', 'Replies', 'Visits', 'Age ▼');
$topics->DefineColumns($columns, 'Headline');
$topics->SetTDClass('Headline', 'topic_headline');
while (list($topic_id, $topic_time, $topic_replies, $topic_visits, $topic_headline) = $res->FetchRow()) {
    $values = array('<a href="/topic/' . $topic_id . '">' . htmlspecialchars($topic_headline) . '</a>', replies($topic_id, $topic_replies), format_number($topic_visits), '<span class="help" title="' . format_date($topic_time) . '">' . calculate_age($topic_time) . '</span>');
    $topics->Row($values);
}
$num_topics_fetched = $topics->num_rows_fetched;
echo $topics->Output('topics');
/* REPLIES */
$res = DB::Execute('SELECT replies.id, replies.parent_id, replies.time, replies.body, topics.headline, topics.time FROM {P}Replies as replies INNER JOIN {P}Topics as topics ON replies.parent_id = topics.id WHERE replies.author = ? ORDER BY id DESC LIMIT ?, ?', array($_SESSION['UID'], $start_listing_at, $items_per_page));
$replies = new TablePrinter('tblReplies');
$columns = array('Reply snippet', 'Topic', 'Age ▼');
$replies->DefineColumns($columns, 'Topic');
$replies->SetTDClass('Topic', 'topic_headline');
$replies->SetTDClass('Reply snippet', 'reply_body_snippet');
while (list($reply_id, $parent_id, $reply_time, $reply_body, $topic_headline, $topic_time) = $res->FetchRow()) {
    $values = array('<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . snippet($reply_body) . '</a>', '<a href="/topic/' . $parent_id . '">' . htmlspecialchars($topic_headline) . '</a> <span class="help unimportant" title="' . format_date($topic_time) . '">(' . calculate_age($topic_time) . ' old)</span>', '<span class="help" title="' . format_date($reply_time) . '">' . calculate_age($reply_time) . '</span>');
    $replies->Row($values);
}
$num_replies_fetched = $replies->num_rows_fetched;
echo $replies->Output('replies');
page_navigation('history', $current_page, $num_replies_fetched);
require 'includes/footer.php';
Ejemplo n.º 4
0
        }
        ?>
			</div>
			<div class="meta">
				<span class="category">分类:<?php 
        the_category(' ', '');
        ?>
</span>|&nbsp;
				<?php 
        the_tags('<span class="tag">标签:', ',', '</span>');
        ?>
				<span class="date">发表于:<?php 
        the_time('Y-m-d');
        ?>
</span>
			</div><!--文章元数据-->
		</div><!--单篇日志结束-->
	<?php 
    }
    ?>
		<?php 
    page_navigation(10);
    ?>
<!--分页-->
	<?php 
} else {
}
wp_reset_query();
?>
<!--在有多个循环体时需要重置循环-->
Ejemplo n.º 5
0
if (!ctype_digit($_GET['p']) || $_GET['p'] < 2) {
    $current_page = 1;
    $page_title = 'Latest replies';
    update_activity('latest_replies');
} else {
    $current_page = $_GET['p'];
    $page_title = 'Replies, page #' . number_format($current_page);
    update_activity('replies', $current_page);
}
// Print out the appropriate replies.
$items_per_page = ITEMS_PER_PAGE;
$start_listing_replies_at = $items_per_page * ($current_page - 1);
$sql = 'SELECT {P}Replies.id, {P}Replies.parent_id, {P}Replies.time, {P}Replies.body, {P}Topics.headline, {P}Topics.time FROM {P}Replies INNER JOIN {P}Topics ON {P}Replies.parent_id = {P}Topics.id ORDER BY id DESC LIMIT %d, %d';
$sql = sprintf($sql, $start_listing_replies_at, $items_per_page);
$res = DB::Execute($sql);
$replies = new TablePrinter('tblReplies');
$columns = array('Snippet', 'Topic', 'Age ▼');
$replies->DefineColumns($columns, 'Topic');
$replies->SetTDClass('Topic', 'topic_headline');
$replies->SetTDClass('Snippet', 'snippet');
if ($res) {
    while (list($reply_id, $parent_id, $reply_time, $reply_body, $topic_headline, $topic_time) = $res->FetchRow()) {
        $values = array('<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . snippet($reply_body) . '</a>', '<a href="/topic/' . $parent_id . '">' . htmlspecialchars($topic_headline) . '</a> <span class="help unimportant" title="' . format_date($topic_time) . '">(' . calculate_age($topic_time) . ' old)</span>', '<span class="help" title="' . format_date($reply_time) . '">' . calculate_age($reply_time) . '</span>');
        $replies->Row($values);
    }
}
$num_replies_fetched = $replies->num_rows_fetched;
echo $replies;
// Navigate backward or forward ...
page_navigation('replies', $current_page, $num_replies_fetched);
require 'includes/footer.php';