Created
September 5, 2012 06:30
-
-
Save itsPG/3631683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
require_once(dirname(__FILE__)."/include/dbConnectObj.inc.php"); | |
require_once(dirname(__FILE__)."/include/phpCaptcha/captcha.inc.php"); | |
?> | |
<!DOCTYPE html> | |
<? | |
$sPageTitle="aBoard Origin"; | |
$sPageSecondTitle="just a board version Origin"; | |
?> | |
<html lang="zh-TW"> | |
<head> | |
<link rel="stylesheet" type="text/css" href="style/layout.css" /> | |
<link rel="stylesheet" type="text/css" href="style/aBoard.css" /> | |
<link rel="shortcut icon" href="image/favicon.ico"> | |
<meta charset="utf-8" /> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script src="./include/js/slidePostBox.js"></script> | |
<script src="./include/js/foldAndExtend.js"></script> | |
<script src="./include/js/articleCache.js"></script> | |
<script src="./include/js/autoSaveArticle.js"></script> | |
<script src="./include/js/configUrl.js"></script> | |
<script src="./include/js/messageShow.js"></script> | |
<title><?echo $sPageTitle;?></title> | |
</head> | |
<div id="main"><body> | |
<?showHeader($sPageTitle, $sPageSecondTitle);?> | |
<div id="content"> | |
<?showArticleBox();?> | |
<?showPostBox();?> | |
</div> | |
<?showFooter();?> | |
</body></div> | |
</html> | |
<? | |
function showArticleBox() { | |
?> | |
<div id="articleBox"> | |
<? | |
$state = ""; | |
$msg = ""; | |
if(isset($_GET['state'])) { | |
$state = strtolower($_GET['state']); | |
if($state == 'success') $msg = "Post a new article successfully!"; | |
else if($state == 'error') $msg = "Post failed, please try again."; | |
else $state = ""; | |
} | |
if($state != "") {?><div id="message" class="<?echo $state?>"><?echo $msg?></div><?}?> | |
<? | |
$aBoard = new aBoardDb(); | |
$table = "article"; | |
$column = array("*"); | |
$where = "1 order by `updateTime` desc"; | |
$result = $aBoard->select($table, $column, $where); | |
$num = $aBoard->num_rows(); | |
for($i = 0; $i < $num; ++$i) { | |
$row = $aBoard->row(); | |
?> | |
<article class="article" id="article<?echo $row['id']?>"> | |
<div class="articleTitle" id="articleTitle<?echo $row['id']?>"> | |
<h1><?echo $row['title'];?></h1> | |
<h2><?echo "First create at ".$row['createTime']." by ";?><span class="author"><?echo $row['author'];?></span>. | |
<?echo "Last update at ".$row['updateTime'].".";?></h2> | |
</div> | |
<div class="articleContent" id="articleContent<?echo $row['id']?>"><?echo $row['content']?></div> | |
<div class="articleFooter" id="articleFooter<?echo $row['id']?>"></div> | |
</article> | |
<? | |
} | |
?> | |
</div> | |
<? | |
} | |
?> | |
<? | |
function showHeader($sPageTitle, $sPageSecondTitle) { | |
?> | |
<header> | |
<h1><?echo $sPageTitle;?></h1> | |
<h2><?echo $sPageSecondTitle;?></h2> | |
</header> | |
<? | |
} | |
function showPostBox() { | |
?> | |
<div id="postBox"> | |
<div id="postBoxTitle">New an Article<span id="postState"></span></div> | |
<div id="postBoxBody"> | |
<form action="newArticle.php" method="post" name="postForm" id="postForm"> | |
<p>Article Title</p> | |
<input type="text" name="postTitle" id="postTitle" value="" maxlength="100" class="full" /><br /> | |
<p>Article Content</p> | |
<textarea name="postContent" id="postContent" rows="20" wrap="off" class="full" ></textarea><br /> | |
<? | |
$CAPTCHA = new CAPTCHA(); | |
$CAPTCHA->captchaImage(); | |
$CAPTCHA->captchaInput(); | |
?> | |
<br /> | |
<input type="reset" name="reset" id="postClear" value="Clear" /> | |
<input type="submit" name="postPost" id="postPost" value="Post" class="right" /> | |
</form> | |
</div> | |
</div> | |
<? | |
} | |
?> | |
<? | |
function showFooter(){ | |
?> | |
<footer><h5>by Yen-Chun Hsu</h5></footer> | |
<? | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment