Beispiel #1
0
                <div class="panel-heading">
                    <!-- Ex 3: Modify forms -->
                    <form class="write-form" action="add.php" method="post">
                        <input type="text" placeholder="Author" name="author">
                        <div>
                            <input type="text" placeholder="Content" name="content">
                        </div>
                        <input type="submit" value="write">
                    </form>
                </div>
                <!-- Ex 3: Modify forms & Load tweets -->
                <?php 
$type = $_GET["type"];
$query = $_GET["query"];
if (isset($type) and isset($query)) {
    $rows = $timeline->searchTweets($type, $query);
} else {
    $rows = $timeline->loadTweets();
}
foreach ($rows as $key => $value) {
    ?>
                <div class="tweet">
                    <form class="delete-form" action="delete.php" method="post">
                        <input type="submit" value="delete">
                        <input type="hidden" name="number" value="<?php 
    echo $value["no"];
    ?>
">
                    </form>
                    <div class="tweet-info">
                        <span><?php 
Beispiel #2
0
            <div class="panel">
                <div class="panel-heading">
                    <form class="write-form" action="add.php" method="post">
                        <input type="text" placeholder="Author" name="author">
                        <div>
                            <input type="text" placeholder="Content" name="content">
                        </div>
                        <input type="submit" value="write">
                    </form>
                </div>
                <div class="tweet">
                    <?php 
$temp;
$timeline = new Timeline();
if (isset($_GET["type"]) && isset($_GET["query"]) && $_GET["type"] != "" && $_GET["query"] != "") {
    $temp = $timeline->searchTweets($_GET["type"], $_GET["query"]);
} else {
    $temp = $timeline->loadTweets();
}
foreach ($temp as $row) {
    $content = $row['content'];
    $replace = preg_replace_callback("/#[^\\s#]+/", create_function('$matches', '$tag = substr($matches[0], 1);return "<a href=index.php?type=content&query=$tag>$matches[0]</a>";'), $content);
    ?>
                    <form class="delete-form" action="delete.php" method="post" >
                    <input type="submit" value="delete">
                    <input type="hidden" name="no" value=<?php 
    echo $row['no'];
    ?>
>
                    </form>
                    <div class="tweet-info">
        ?>
</span>
                                </div>
                                <div class="tweet-content">
                                    <?php 
        echo $row['contents'];
        ?>
                                </div>
                            </div>            
                            <?php 
    }
} else {
    if (isset($_GET["type"]) && isset($_GET["query"])) {
        $qry = $_GET["query"];
        $newQry = htmlspecialchars($qry, ENT_QUOTES);
        $rows = $tl->searchTweets($_GET["type"], $newQry);
        foreach ($rows as $row) {
            /* Hash Tag */
            // $con = $row[2];
            // $tag = "<a href=\"index.php?type=Content&query=%23$1\">#$1</a>";
            // $con = preg_replace("/#([_]*[a-zA-Z0-9가-힣]+[\w가-힣]*)/", $tag, $con);
            // $row[2] = $con;
            /*  Time Format
                0123456789012345678
                2015-11-13 01:19:44 
                hour:minute:second date/month/year 
                SELECT DATE_FORMAT(NOW(), '%h:%i:%s %d/%m/%y'); */
            $hour = substr($row[3], 11, 8);
            $date = substr($row[3], 8, 2);
            $month = substr($row[3], 5, 2);
            $year = substr($row[3], 0, 4);