Пример #1
0
?>
" >
				<button class="wmd-submit" type="submit" ><i class='fa fa-search fa-fw'></i></button>
			</form>
                        
                        
<?php 
//ini_set("display_errors",1);
error_reporting(1);
if (!empty($_GET["search"])) {
    $words = $_GET["search"];
    //メタ文字のescape化
    $words2 = preg_replace_callback("/[\\*\\?\\+\\[\\]\\(\\)\\{\\}\\^\$\\|\\\\.\\/]/", function ($matches) {
        return "\\" . $matches[0];
    }, $words);
    $threads = Thread::all();
    $result_list = array();
    //全スレッド
    for ($j = 0; $j < count($threads); $j++) {
        $Post = $threads[$j]->getAllPosts();
        //全ポスト
        for ($i = 0; $i < count($Post); $i++) {
            //本文の抜出し
            $html = str_get_html($Post[$i]->getContent());
            //本文match?
            if (preg_match("/{$words2}/i", $html->plaintext)) {
                $obj = array("thread_id" => $threads[$j]->getId(), "post_id" => $Post[$i]->getPostId(), "title" => $threads[$j]->getTitle(), "body" => $html->plaintext);
                array_push($result_list, $obj);
            }
        }
    }
Пример #2
0
		<table >
			<thead>
				<tr>
					<td>id</td>
					<td>タイトル</td>
					<td>スレのホスト</td>
					<td>Guest</td>
					<td>野田</td>
					<td>葛飾</td>
					<td>削除</td>
				</tr>
			</thead>
			<tbody>

			 	<?php 
foreach (Thread::all() as $thread) {
    ?>
				<tr>
					<td><?php 
    echo $thread->getId();
    ?>
</td>
					<td> <?php 
    echo $thread->getTitle();
    ?>
 </td>
					<td> <?php 
    echo $thread->getHost()->getNickname();
    ?>
</td>
					<?php 
 public function home()
 {
     $threads = Thread::all();
     require_once ROOT . DS . 'application' . DS . 'view' . DS . 'home.php';
 }
Пример #4
0
 public static function threadList()
 {
     $threads = Thread::all();
     View::make('thread/thread_list.html', array('threads' => $threads));
 }