Example #1
0
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Simple Timeline</title>
        <link rel="stylesheet" href="timeline.css">
    </head>
    <body>
        <?php 
include "timeline.php";
$timeline = new TimeLine();
?>
        <div>
            <a href="index.php"><h1>Simple Timeline</h1></a>
            <div class="search">
                <!-- Ex 3: Modify forms -->
                <form class="search-form" action="index.php">
                    <input type="submit" value="search">
                    <input type="text" placeholder="Search" name="query">
                    <select name="type">
                        <option value="author">Author</option>
                        <option value="content">Content</option>
                    </select>
                </form>
            </div>
            <div class="panel">
                <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>
Example #2
0
 /**
  * DailyTimeLine constructor
  *
  * @param timestamp $start_time Start time
  * @param timestamp $end_time End time
  */
 function DailyTimeLine($start_time, $end_time)
 {
     $this->_step = (double) 24 * 60 * 60;
     parent::TimeLine($start_time, $end_time);
 }
Example #3
0
<?php

try {
    require_once "timeline.php";
    if (preg_match("/^[a-zA-Z]+(?:[\\s-][a-zA-Z]+)*\$/", $_POST["author"])) {
        $timeline = new TimeLine();
        $author = $_POST["author"];
        $contents = htmlspecialchars($_POST["contents"]);
        $tweets = $author . "," . $contents;
        $timeline->add($tweets);
        header("Location:index.php");
    } else {
        header("Loaction:error.php");
    }
} catch (Exception $e) {
    header("Loaction:error.php");
}
Example #4
0
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Simple Timeline</title>
        <link rel="stylesheet" href="timeline.css">
    </head>
    <body>
        <?php 
include "timeline.php";
$timeline = new TimeLine();
?>
        <div>
            <a href="index.php"><h1>Simple Timeline</h1></a>
            <div class="search">
                <!-- Ex 3: Modify forms -->
                <form class="search-form" method="GET" action="index.php">
                    <input type="submit" value="search">
                    <input type="text" name="text" placeholder="Search">
                    <select name="select">
                        <option value="author">Author</option>
                        <option value="contents">Content</option>
                    </select>
                </form>
            </div>
            <div class="panel">
                <div class="panel-heading">
                    <!-- Ex 3: Modify forms -->
                    <form class="write-form" method="POST" action="add.php">
                        <input type="text" name="input_author" placeholder="Author">
                        <div>
Example #5
0
<?php

# Ex 4 : Write a tweet
try {
    $i_type = $_GET["i_type"];
    $i_text = $_GET["i_text"];
    if (empty($i_type) == false && empty($i_text) == false) {
        $remove_tag = strip_tags($i_text);
        $reg_ex = "/^(([a-zA-Z][\\-|\\s]?){1,20}([a-zA-Z]))\$/";
        if (preg_match($reg_ex, $i_type)) {
            #call add function
            require_once 'timeline.php';
            $i_class = new TimeLine();
            $i_class->add($i_type . "|" . $remove_tag);
            #redirect (don't modify)
            header("Location:index.php");
        } else {
            #redirect (don't modify)
            header("Loaction:error.php");
        }
    }
} catch (Exception $e) {
    #redirect (don't modify)
    header("Loaction:error.php");
}
Example #6
0
<?php

# Ex 4 : Write a tweet
require_once "timeline.php";
$timeline = new TimeLine();
try {
    $content = htmlspecialchars($_POST['content']);
    $regex = "/^([a-zA-Zㄱ-ㅎ가-힣] |[a-zA-Zㄱ-ㅎ가-힣]-|[a-zA-Zㄱ-ㅎ가-힣]){0,19}[a-zA-Zㄱ-ㅎ가-힣]\$/";
    if (preg_match($regex, $_POST['author'])) {
        $tweet = array();
        array_push($tweet, $_POST['author']);
        array_push($tweet, $content);
        $timeline->add($tweet);
        header("Location:index.php");
        // redirect to index.php
    } else {
        header("Location:error.php");
    }
} catch (Exception $e) {
    header("Location:error.php");
}
Example #7
0
            </div>
            <div class="panel">
                <div class="panel-heading">
                    <!-- Ex 3: Modify forms -->
                    <form class="write-form" action="add.php" method="post">
                        <input type="text" name="author" placeholder="Author">
                        <div>
                            <input type="text" name="content" placeholder="Content">
                        </div>
                        <input type="submit" value="write">
                    </form>
                </div>
                <!-- Ex 3: Modify forms & Load tweets -->
				<?php 
include "timeline.php";
$database = new TimeLine();
if (!empty($_GET['query']) && isset($_GET['query']) && isset($_GET['type'])) {
    $rows = $database->searchTweets($_GET['type'], $_GET['query']);
} else {
    $rows = $database->loadTweets();
}
foreach ($rows as $row) {
    ?>
<div class="tweet">
							<form class="delete-form" action="delete.php" method="post">
								<input type="submit" value="delete">
								<input type="hidden" name="count" value=<?php 
    echo $row["no"];
    ?>
>
							</form>
Example #8
0
<?php

include 'timeline.php';
require_once 'base.php';
$userid = $_SESSION['user_id'];
$TL = new TimeLine();
try {
    if (isset($_POST['author'])) {
        $author = $_POST['author'];
    }
    if (isset($_POST['content'])) {
        $content = $_POST['content'];
    }
    if (isset($_POST['reply'])) {
        $reply = $_POST['reply'];
    }
    $content = htmlspecialchars($content);
    $tweet = array($author, $content);
    if (isset($userid) && strlen($content) > 0) {
        if (isset($reply)) {
            $TL->addReply($tweet, $reply);
            header("Location:contents.php?reply={$reply}");
            ?>
 
                <?php 
            echo "<script>location.replace(\"contents.php?reply={$reply}\")</script>";
        } else {
            if (!isset($reply)) {
                $TL->addReply($tweet, $reply);
                ?>
                <?php 
Example #9
0
<?php

# Ex 4 : Write a tweet
try {
    include "timeline.php";
    if (!empty($_POST["author"]) && !empty($_POST["content"]) && preg_match('/^[a-zA-Z]((-|\\s)?[a-zA-Z]){0,19}$/', $_POST["author"])) {
        $author = $_POST["author"];
        $content = htmlspecialchars($_POST["content"]);
        //$content = $_POST["content"];
        $toadd = array($author, $content);
        $tl = new TimeLine();
        $tl->add($toadd);
        header("Location:index.php");
    } else {
        //echo "else";
        header("Location:error.php");
    }
} catch (Exception $e) {
    header("Location:error.php");
}
// && preg_match('/^[a-zA-Z]+(-[a-zA-Z]+)*(\s?[a-zA-Z]+(-[a-zA-Z]+)*)*$/', $_POST["author"])
//!empty($_POST["author"]) && !empty($_POST["content"])
//^[4][0-9]{15}
Example #10
0
<?php

require_once "timeline.php";
try {
    $timeline = new TimeLine();
    $timeline->delete($_POST["no"]);
    #call delete function
    header("Location:index.php");
} catch (Exception $e) {
    header("Loaction:error.php");
}
Example #11
0
            	
                <div class="panel-heading">
                    <!-- Ex 3: Modify forms -->
                    
                    <form action="add.php" method="POST" class="write-form">
                        <input type="text" name="author" placeholder="Author">
                        <div>
                            <input type="text" name="content" placeholder="Content">
                        </div>
                        <input type="submit" value="write">
                    </form>
                </div>
                <!-- Ex 3: Modify forms & Load tweets -->
                <?php 
include "timeline.php";
$tl = new TimeLine();
if (isset($_GET["srchcontent"])) {
    $getsrch = isset($_GET["srch"]) ? $_GET["srch"] : ' ';
    $getsrchcontent = isset($_GET["srchcontent"]) ? $_GET["srchcontent"] : ' ';
    $tl->searchTweets($getsrch, $getsrchcontent);
} else {
    $tl->loadTweets();
}
?>
                <!--
                <div class="tweet">
                    <form class="delete-form">
                        <input type="submit" value="delete">
                        <input type="hidden">
                    </form>
                    <div class="tweet-info">
Example #12
0
<?php

require_once 'base.php';
include 'timeline.php';
$TL = new TimeLine();
$rows = $TL->loadTweets();
if (!empty($_GET['type']) && !empty($_GET['query'])) {
    $type = $_GET['type'];
    $query = $_GET['query'];
    $rows = $TL->searchTweets($type, $query);
} else {
    if (!empty($_GET['reply'])) {
        $reply = $_GET['reply'];
        $rows = $TL->searchReply($reply);
    }
}
$username = $_SESSION['user_id'];
?>

<?php 
startblock('head');
?>
        <link rel="stylesheet" href="css/contents.css">
<?php 
endblock('head');
?>

<?php 
startblock('content');
?>
        <div id="community">
Example #13
0
                </form>
            </div>
            <div class="panel">
                <div class="panel-heading">
                    <!-- Ex 3: Modify forms -->
                    <form action="add.php"> 
                        <input type="text" placeholder="Author" name="i_type">
                        <div>
                            <input type="text" placeholder="Content" name="i_text">
                        </div>
                        <input type="submit" value="write">
                    </form>
                </div>
				
                <!-- Ex 3: Modify forms & Load tweets -->
				<?php 
require_once 'timeline.php';
$tclass = new TimeLine();
$g_type = $_GET["c_type"];
$g_text = $_GET["c_text"];
if (isset($g_text) == true) {
    $rdata = $tclass->searchTweets($g_type, $g_text);
} else {
    $rdata = $tclass->loadTweets();
}
?>
            </div>
        </div>
    </body>
</html>
Example #14
0
<?php

require_once 'timeline.php';
# Ex 4 : Write a tweet
try {
    $timeline = new TimeLine();
    $timeline->add(array("author" => $_POST['author'], "contents" => $_POST['content']));
    header("Location:index.php");
    /*
    if () { validate author & content
        call add function
        header("Location:index.php"); redirect to index.php 마지막
    } else {
        header("Loaction:error.php");
    }
    */
} catch (Exception $e) {
    header("Loaction:error.php");
}
Example #15
0
 /**
  * HourlyTimeLine constructor
  *
  * @param timestamp $start_time Start time
  * @param timestamp $end_time End time
  */
 function HourlyTimeLine($start_time, $end_time)
 {
     $this->_step = 60 * 60;
     parent::TimeLine($start_time, $end_time);
     $this->setMaxDifference(48);
 }
 public static function updateTimeLine($oldTl, $newTl)
 {
     $timeline = new TimeLine();
     return $timeline->updateTimeLine($oldTl, $newTl);
 }
Example #17
0
<?php

# Ex 5 : Delete a tweet
require_once "timeline.php";
$timeline = new TimeLine();
try {
    $timeline->delete($_POST['no']);
    header("Location:index.php");
} catch (Exception $e) {
    header("Loaction:error.php");
}
Example #18
0
<?php

include 'timeline.php';
# Ex 4 : Write a tweet
try {
    if (preg_match("/^(?=.{1,20}\$)([a-zA-z]+[\\-\\s]?[a-zA-z]+)*[a-zA-Z]\$/", $_POST["author"])) {
        #validate author & content call add function
        $content = htmlspecialchars($_POST['content']);
        #insert into table
        $timeline = new TimeLine();
        $timeline->add(array($_POST["author"], $content));
        header("Location:index.php");
        #redirect to index.php
    } else {
        header("Location:error.php");
    }
} catch (Exception $e) {
    header("Location:error.php");
}
Example #19
0
<?php

# Ex 5 : Delete a tweet
try {
    include "timeline.php";
    $database = new TimeLine();
    $database->delete((int) $_POST["count"]);
    header("Location:index.php");
} catch (Exception $e) {
    header("Location:error.php");
}
Example #20
0
File: add.php Project: joontae/web0
<?php

# Ex 4 : Write a tweet
try {
    include "timeline.php";
    $database = new TimeLine();
    $content = $_POST["content"];
    $content = htmlspecialchars($content);
    if (preg_match("/^([a-zA-Z]+\\-{0,1}[a-zA-Z]*)+\\s{0,1}([a-zA-Z]+\\-{0,1}[a-zA-Z]*)*\\s{0,1}([a-zA-Z]+\\-{0,1}[a-zA-Z]*)*[a-zA-Z]\$/", $_POST["author"]) && strlen($_POST["author"]) >= 1 && strlen($_POST["author"]) <= 20) {
        //validate author & contents
        $database->add(array($_POST["author"], $content));
        header("Location:index.php");
        //redirect to index.php
    } else {
        header("Location:error.php");
    }
} catch (Exception $e) {
    header("Loaction:error.php");
}
Example #21
0
            </form>
        </div>
        <div class="panel">
            <div class="panel-heading">
                <!-- Ex 3: Modify forms -->
                <form action="add.php" class="write-form" method="post">
                    <input name="author" type="text" placeholder="Author">
                    <div>
                        <input name="content" type="text" placeholder="Content">
                    </div>
                    <input type="submit" value="write">
                </form>
            </div>
            <!-- Ex 3: Modify forms & Load tweets -->
            <?php 
$timeline = new TimeLine();
if (isset($_GET['type']) && isset($_GET['query'])) {
    $posts = $timeline->searchTweets($_GET['type'], $_GET['query']);
} else {
    $posts = $timeline->loadTweets();
}
foreach ($posts as $post) {
    ?>
            <div class="tweet">
                <form action="delete.php" class="delete-form" method="post">
                    <input type="submit" value="delete">
                    <input name="no" type="hidden" value="<?php 
    echo $post['no'];
    ?>
">
                </form>
Example #22
0
<?php

# Ex 5 : Delete a tweet
try {
    include "timeline.php";
    $tl = new TimeLine();
    $getno = isset($_POST["no"]) ? $_POST["no"] : ' ';
    $tl->delete($getno);
    header("Location:index.php");
} catch (Exception $e) {
    header("Location:error.php");
}
Example #23
0
<!DOCTYPE html>
<?php 
require_once "timeline.php";
$timeline = new TimeLine();
?>

<html>
    <head>
        <meta charset="utf-8">
        <title>Simple Timeline</title>
        <link rel="stylesheet" href="timeline.css">
    </head>
    <body>
        <div>
            <a href="index.php"><h1>Simple Timeline</h1></a>
            <div class="search">
                <!-- Ex 3: Modify forms -->
                <form method="GET" class="search-form" action="index.php">
                    <input type="submit" value="search">
                    <input type="text" placeholder="Search" name="contents">
                    <select name="type">
                        <option>Author</option>
                        <option>Content</option>
                    </select>
                </form>
            </div>
            <div class="panel">
                <div class="panel-heading">
                    <!-- Ex 3: Modify forms -->
                    <form method="POST" class="write-form" action="add.php">
                        <input type="text" placeholder="Author" name="author">
Example #24
0
File: index.php Project: hosewq/CSE
            </div>
            <div class="panel">
                <div class="panel-heading">
                    <!-- Ex 3: Modify forms -->
                    <form class="write-form" action="add.php" method="POST">
                        <input type="text" name="author" placeholder="Author">
                        <div>
                            <input type="text" name="contents" placeholder="Content">
                        </div>
                        <input type="submit" value="write">
                    </form>
                </div>
                <!-- Ex 3: Modify forms & Load tweets -->
                <?php 
include 'timeline.php';
$timeline = new TimeLine();
if (!empty($_GET["type"]) && !empty($_GET["query"])) {
    $type = $_GET["type"];
    $query = $_GET["query"];
    $rows = $timeline->searchTweets($type, $query);
    if (empty($rows)) {
        $rows = $timeline->loadTweets();
    }
} else {
    $rows = $timeline->loadTweets();
}
foreach ($rows as $row) {
    $time = explode(" ", $row["time"]);
    $date = explode("-", $time[0]);
    ?>
                <div class="tweet">
Example #25
0
<?php

include "timeline.php";
$timeline = new TimeLine();
# Ex 5 : Delete a tweet
try {
    $input_no = $_POST["num"];
    $timeline->delete($input_no);
    header("Location:index.php");
} catch (Exception $e) {
    header("Location:error.php");
}
Example #26
0
<?php

# Ex 5 : Delete a tweet
try {
    // call delete function
    include 'timeline.php';
    $timeline = new TimeLine();
    $no = $_POST["no"];
    $timeline->delete($no);
    header("Location:index.php");
} catch (Exception $e) {
    header("Location:error.php");
}
Example #27
0
 /**
  * WeeklyTimeLine constructor
  *
  * @param timestamp $start_time Start time
  * @param timestamp $end_time End time
  */
 function WeeklyTimeLine($start_time, $end_time)
 {
     parent::TimeLine($start_time, $end_time);
     $this->_step = 7 * 24 * 60 * 60;
 }
Example #28
0
 /**
  * MonthlyTimeLine constructor
  *
  * @param timestamp $start_time Start time
  * @param timestamp $end_time End time
  */
 function MonthlyTimeLine($start_time, $end_time)
 {
     parent::TimeLine($start_time, $end_time);
     $this->_step = 30 * 24 * 60 * 60;
 }
Example #29
0
<?php

# Ex 5 : Delete a tweet
try {
    include 'timeline.php';
    require_once 'base.php';
    $username = $_SESSION['user_id'];
    $TL = new TimeLine();
    if (isset($_POST['no'])) {
        $no = $_POST['no'];
    }
    if (isset($_POST['author'])) {
        $author = $_POST['author'];
    }
    if (empty($username)) {
        ?>
  		<?php 
        echo "<script>alert('로그인 해주세요'); location.replace(\"contents.php\")</script>";
    } else {
        if ($username != $author) {
            ?>
	
  		<?php 
            echo "<script>alert('다른사람 글 삭제 할 수 없다'); location.replace(\"contents.php\")</script>";
        } else {
            $TL->delete($no);
            ?>
  		<?php 
            echo "<script>alert('삭제'); location.replace(\"contents.php\")</script>";
        }
    }
Example #30
0
<?php

include "timeline.php";
$timeline = new TimeLine();
# Ex 4 : Write a tweet
try {
    $author = $_POST["input_author"];
    $contents = htmlspecialchars($_POST["input_contents"]);
    if (preg_match("/^[a-zA-Z]+((\\s{1}|\\-{1}){1}[a-zA-Z]+)*\$/", $author) && 1 <= strlen($author) && strlen($author) <= 20) {
        //validate author & content
        if ($contents != "") {
            $input_tweet = array($author, $contents);
            $timeline->add($input_tweet);
            header("Location:index.php");
        } else {
            header("Location:error.php");
            //contents에 아무것도 입력하지 않았을 때에는 error
        }
    } else {
        header("Location:error.php");
    }
} catch (Exception $e) {
    header("Location:error.php");
}