mirror of https://github.com/BOINC/boinc.git
parent
db3c0d658f
commit
4bea90ccee
|
@ -0,0 +1,205 @@
|
|||
<?php
|
||||
|
||||
require_once('../include/database.inc');
|
||||
|
||||
class Category {
|
||||
var $id;
|
||||
var $name;
|
||||
|
||||
function Category($id = -1, $name = '') {
|
||||
$vars = get_class_vars('Category');
|
||||
foreach ($vars as $var => $value)
|
||||
$this->$var = $$var;
|
||||
}
|
||||
|
||||
function getForums() {
|
||||
$sql = 'SELECT * FROM forum WHERE category = '.$this->id.' ORDER BY orderID ASC';
|
||||
return sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
class Forum {
|
||||
var $id;
|
||||
var $category;
|
||||
var $orderID;
|
||||
var $title;
|
||||
var $description;
|
||||
var $timestamp;
|
||||
var $threads;
|
||||
var $posts;
|
||||
|
||||
function Forum($id = -1, $category = -1, $orderID = -1, $title = '', $description = '', $timestamp = 0, $threads = 0, $posts = 0) {
|
||||
$vars = get_class_vars('Forum');
|
||||
foreach ($vars as $var => $value)
|
||||
$this->$var = $$var;
|
||||
}
|
||||
|
||||
function getThreads($min = -1, $nRec = -1) {
|
||||
$sql = 'SELECT * FROM thread WHERE forum = '.$this->id.' ORDER BY timestamp DESC';
|
||||
if ($min > -1) {
|
||||
$sql .= ' LIMIT '.$min;
|
||||
if ($nRec > -1)
|
||||
$sql .= ', '.$nRec;
|
||||
} elseif ($nRec > -1)
|
||||
$sql .= ' LIMIT '.$nRec;
|
||||
return sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
class Thread {
|
||||
var $id;
|
||||
var $forum;
|
||||
var $owner;
|
||||
|
||||
var $title;
|
||||
|
||||
var $timestamp;
|
||||
var $views;
|
||||
var $replies;
|
||||
|
||||
function Thread($id = -1, $forum = -1, $owner = -1, $title = '', $timestamp = 0, $views = 0, $replies = 0) {
|
||||
$vars = get_class_vars('Thread');
|
||||
foreach ($vars as $var => $value)
|
||||
$this->$var = $$var;
|
||||
}
|
||||
|
||||
function getPosts($min = -1, $nRec = -1) {
|
||||
$sql = 'SELECT * FROM post WHERE thread = '.$this->id.' ORDER BY id ASC';
|
||||
if ($min > -1) {
|
||||
$sql .= ' LIMIT '.$min;
|
||||
if ($nRec > -1)
|
||||
$sql .= ', '.$nRec;
|
||||
} elseif ($nRec > -1)
|
||||
$sql .= ' LIMIT '.$nRec;
|
||||
return sql_query($sql);
|
||||
}
|
||||
|
||||
function post($content) {
|
||||
$title = addslashes(htmlentities($this->title));
|
||||
$content = addslashes(htmlentities($content));
|
||||
|
||||
$sql = "INSERT INTO thread (forum, owner, title, timestamp) VALUES (".$this->forum.", ".$this->owner.", '".$title."', UNIX_TIMESTAMP())";
|
||||
$result = sql_query($sql);
|
||||
if (!$result)
|
||||
return false;
|
||||
$this->id = sql_insert_id();
|
||||
|
||||
$post = new Post();
|
||||
$post->thread = $this->id;
|
||||
$post->user = $this->owner;
|
||||
$post->content = $content;
|
||||
$postID = $post->insert();
|
||||
|
||||
$sql = "UPDATE user SET posts = posts + 1 WHERE id = ".$this->owner." LIMIT 1";
|
||||
sql_query($sql);
|
||||
|
||||
$sql = "UPDATE forum SET threads = threads + 1, posts = posts + 1, timestamp = UNIX_TIMESTAMP() WHERE id = ".$this->forum." LIMIT 1";
|
||||
sql_query($sql);
|
||||
|
||||
return $thread->id;
|
||||
}
|
||||
|
||||
function reply($user = -1, $content = "") {
|
||||
$content = addslashes(htmlentities($content));
|
||||
|
||||
$post = new Post();
|
||||
$post->thread = $this->id;
|
||||
$post->user = $user;
|
||||
$post->content = $content;
|
||||
$postID = $post->insert();
|
||||
|
||||
$sql = "UPDATE user SET posts = posts + 1 WHERE id = ".$user." LIMIT 1";
|
||||
sql_query($sql);
|
||||
|
||||
$sql = "UPDATE thread SET replies = replies + 1, timestamp = UNIX_TIMESTAMP() WHERE id = ".$this->id." LIMIT 1";
|
||||
sql_query($sql);
|
||||
|
||||
$sql = "UPDATE forum SET posts = posts + 1, timestamp = UNIX_TIMESTAMP() WHERE id = ".$this->forum." LIMIT 1";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
function incView() {
|
||||
$sql = "UPDATE thread SET views = views + 1 WHERE id = ".$this->id." LIMIT 1";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
class Post {
|
||||
var $id;
|
||||
var $thread;
|
||||
var $user;
|
||||
var $timestamp;
|
||||
var $content;
|
||||
|
||||
function Post($id = -1, $thread = -1, $user = -1, $timestamp = 0, $content = "") {
|
||||
$vars = get_class_vars('Post');
|
||||
foreach ($vars as $var => $value)
|
||||
$this->$var = $$var;
|
||||
}
|
||||
|
||||
function insert() {
|
||||
$sql = "INSERT INTO post (thread, user, timestamp, content) VALUES (".$this->thread.", ".$this->user.", UNIX_TIMESTAMP(), '".$this->content."')";
|
||||
$result = sql_query($sql);
|
||||
if (!$result)
|
||||
return false;
|
||||
return ($this->id = sql_insert_id());
|
||||
}
|
||||
}
|
||||
|
||||
/* group database functions */
|
||||
|
||||
function getCategories() {
|
||||
$langID = (!empty($_SESSION['lang']['id']))?$_SESSION['lang']['id']:1;
|
||||
$sql = "SELECT * FROM category WHERE lang = ".$langID." ORDER BY orderID ASC";
|
||||
return sql_query($sql);
|
||||
}
|
||||
|
||||
function getNextCategory($result) {
|
||||
$category = sql_fetch_array($result);
|
||||
if (!$category)
|
||||
return false;
|
||||
foreach ($category as $var => $value)
|
||||
$category[$var] = stripslashes($value);
|
||||
return new Category($category['id'], $category['name']);
|
||||
}
|
||||
|
||||
function getNextForum($result) {
|
||||
$forum = sql_fetch_array($result);
|
||||
if (!$forum)
|
||||
return false;
|
||||
foreach ($forum as $var => $value)
|
||||
$forum[$var] = stripslashes($value);
|
||||
return new Forum($forum['id'], $forum['category'], $forum['orderID'], $forum['title'], $forum['description'], $forum['timestamp'], $forum['threads'], $forum['posts']);
|
||||
}
|
||||
|
||||
function getNextThread($result) {
|
||||
$thread = sql_fetch_array($result);
|
||||
if (!$thread)
|
||||
return false;
|
||||
foreach ($thread as $var => $value)
|
||||
$thread[$var] = stripslashes($value);
|
||||
return new Thread($thread['id'], $thread['forum'], $thread['owner'], $thread['title'], $thread['timestamp'], $thread['views'], $thread['replies']);
|
||||
}
|
||||
|
||||
function getNextPost($result) {
|
||||
$post = sql_fetch_array($result);
|
||||
if (!$post)
|
||||
return false;
|
||||
foreach ($post as $var => $value)
|
||||
$post[$var] = stripslashes($value);
|
||||
return new Post($post['id'], $post['thread'], $post['user'], $post['timestamp'], $post['content']);
|
||||
}
|
||||
|
||||
/* specific database functions */
|
||||
|
||||
function getForum($forumID) {
|
||||
$sql = "SELECT * FROM forum WHERE id = ".$forumID;
|
||||
return getNextForum(sql_query($sql));
|
||||
}
|
||||
|
||||
function getThread($threadID) {
|
||||
$sql = "SELECT * FROM thread WHERE id = ".$threadID;
|
||||
return getNextThread(sql_query($sql));
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
require_once('../include.php');
|
||||
require_once('forum.inc');
|
||||
doHeader('Forum');
|
||||
|
||||
$n = 50;
|
||||
|
||||
/* sanitize variable */
|
||||
$_GET['id'] = stripslashes(strip_tags($_GET['id']));
|
||||
|
||||
if (!array_key_exists('start', $_GET) || $_GET['start'] < 0)
|
||||
$_GET['start'] = 0;
|
||||
|
||||
$forum = getForum($_GET['id']);
|
||||
?>
|
||||
|
||||
<p>
|
||||
<span class="title"><?php echo $forum->title ?></span>
|
||||
<br><a href="index.php"><?php echo $cfg['sitename'] ?> Forum</a>
|
||||
</p>
|
||||
<p><a href="post.php?id=<?php echo $_GET['id'] ?>">Post a New Thread / Question</a></p>
|
||||
|
||||
<?php
|
||||
if ($forum->threads > $n):
|
||||
$totalPages = floor($forum->threads / $n);
|
||||
$curPage = floor($_GET['start'] / $n);
|
||||
|
||||
$pages = array(0, 1, 2);
|
||||
for ($i = -1 ; $i <= 1 ; $i++)
|
||||
if ($curPage + $i > 0 && $curPage + $i < $totalPages - 1)
|
||||
array_push($pages, $curPage + $i);
|
||||
for ($i = -3 ; $i <= -1 ; $i++)
|
||||
if ($totalPages + $i > 0)
|
||||
array_push($pages, $totalPages + $i);
|
||||
$pages = array_unique($pages);
|
||||
natsort($pages);
|
||||
$pages = array_values($pages);
|
||||
|
||||
$gotoStr = '<p style="text-align:right">Goto page ';
|
||||
|
||||
if ($curPage == 0)
|
||||
$gotoStr .= '<span style="font-size:larger; font-weight:bold">1</span>';
|
||||
else
|
||||
$gotoStr .= '<a href="forum.php?id='.$_GET['id'].'&start='.(($curPage-1)*$n).'">Previous</a> <a href="forum.php?id='.$_GET['id'].'&start=0">1</a>';
|
||||
|
||||
for ($i = 1 ; $i < count($pages)-1 ; $i++) {
|
||||
if ($curPage == $pages[$i]) {
|
||||
$gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... ';
|
||||
$gotoStr .= '<span style="font-size:larger; font-weight:bold">'.($pages[$i]+1).'</span>';
|
||||
} else {
|
||||
$gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... ';
|
||||
$gotoStr .= '<a href="forum.php?id='.$_GET['id'].'&start='.($pages[$i]*$n).'">'.($pages[$i]+1).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($curPage == $totalPages-1)
|
||||
$gotoStr .= ', <span style="font-size:larger; font-weight:bold">'.$totalPages.'</span>';
|
||||
else
|
||||
$gotoStr .= ', <a href="forum.php?id='.$_GET['id'].'&start='.(($totalPages-1)*$n).'">'.$totalPages.'</a> <a href="forum.php?id='.$_GET['id'].'&start='.(($curPage+1)*$n).'">Next</a>';
|
||||
|
||||
$gotoStr .= '</p>';
|
||||
|
||||
echo $gotoStr;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<p>
|
||||
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>Titles</th>
|
||||
<th style="width: 50px">Replies</th>
|
||||
<th style="width: 150px">Author</th>
|
||||
<th style="width: 50px">Views</th>
|
||||
<th style="width: 170px">Last Post</th>
|
||||
</tr>
|
||||
<?php
|
||||
$threads = $forum->getThreads($_GET['start'], $n);
|
||||
while($thread = getNextThread($threads)):
|
||||
$user = getUser($thread->owner);
|
||||
?>
|
||||
<tr style="font-size:8pt; text-align:center">
|
||||
<td class="col1" style="font-size:10pt; text-align:left"><a href="thread.php?id=<?php echo $thread->id ?>"><b><?php echo stripslashes($thread->title) ?></b></a></td>
|
||||
<td class="col2"><?php echo $thread->replies ?></td>
|
||||
<td class="col3"><a href="../view_profile.php?userid=<?php echo $thread->owner ?>"><?php echo $user->name ?></a></td>
|
||||
<td class="col2"><?php echo $thread->views ?></td>
|
||||
<td class="col3" style="text-align:right"><?php echo date('D M j, Y g:i a', $thread->timestamp) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
if ($forum->threads > $n)
|
||||
echo $gotoStr;
|
||||
?>
|
||||
|
||||
<?php
|
||||
doFooter();
|
||||
?>
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
require_once('../include.php');
|
||||
require_once('forum.inc');
|
||||
|
||||
if (!empty($_GET['lang'])) {
|
||||
$sql = "SELECT * FROM lang WHERE id = ".$_GET['lang']." LIMIT 1";
|
||||
$lang = sql_fetch_array(sql_query($sql));
|
||||
$_SESSION['lang']['id'] = $lang['id'];
|
||||
$_SESSION['lang']['charset'] = $lang['charset'];
|
||||
}
|
||||
|
||||
doHeader('Forum', 'forum.css');
|
||||
?>
|
||||
|
||||
<p class="title"><?php echo $cfg['sitename'] ?> Forum</p>
|
||||
<p style="text-align:right">
|
||||
<form action="index.php" method="get">
|
||||
Language filter:
|
||||
<select name="lang">
|
||||
<?php
|
||||
$sql = "SELECT * FROM lang ORDER BY name";
|
||||
$langs = sql_query($sql);
|
||||
while ($lang = sql_fetch_array($langs)):
|
||||
?>
|
||||
<option value="<?php echo $lang['id'] ?>"<?php echo ($lang['id']==$_SESSION['lang']['id'])?' selected':'' ?>><?php echo $lang['name'] ?> (<?php echo $lang['charset'] ?>)</option>
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="Go">
|
||||
</form>
|
||||
</p>
|
||||
<p style="text-align:center">
|
||||
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>Forum</th>
|
||||
<th style="width: 60px">Threads</th>
|
||||
<th style="width: 60px">Posts</th>
|
||||
<th style="width: 160px">Last Post</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$categories = getCategories();
|
||||
while ($category = getNextCategory($categories)):
|
||||
?>
|
||||
<tr class="subtitle">
|
||||
<td colspan="4"><?php echo $category->name ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
$forums = $category->getForums();
|
||||
while ($forum = getNextForum($forums)):
|
||||
?>
|
||||
<tr style="font-size:8pt; text-align:right">
|
||||
<td style="text-align:left">
|
||||
<span style="font-size:10pt; font-weight:bold"><a href="forum.php?id=<?php echo $forum->id ?>"><?php echo $forum->title ?></a></span>
|
||||
<br><?php echo $forum->description ?>
|
||||
</td>
|
||||
<td><?php echo $forum->threads ?></td>
|
||||
<td><?php echo $forum->posts ?></td>
|
||||
<td><?php echo date('D M j, Y g:i a', $forum->timestamp) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
endwhile;
|
||||
?>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
doFooter();
|
||||
?>
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
require_once('../include.php');
|
||||
require_once('forum.inc');
|
||||
|
||||
if (array_key_exists('id', $_GET) && $_GET['id'] > 0) {
|
||||
$lang = getLanguage($_GET['id']);
|
||||
$_SESSION['lang']['id'] = $lang->langID;
|
||||
$_SESSION['lang']['charset'] = $lang->charset;
|
||||
}
|
||||
|
||||
header('Location: http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['PATH_INFO'], 0, strrpos($_SERVER['PATH_INFO'], '/')).'/index.php');
|
||||
?>
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
require_once('../include.php');
|
||||
require_once('forum.inc');
|
||||
require_once('../util.inc');
|
||||
|
||||
if (!empty($_GET['id']) && !empty($_POST['title']) && !empty($_POST['content'])) {
|
||||
$_GET['id'] = stripslashes(strip_tags($_GET['id']));
|
||||
|
||||
//$user = getUserByAuth($_SESSION['authenticator']);
|
||||
$user = get_logged_in_user(true);
|
||||
|
||||
$thread = new Thread();
|
||||
|
||||
$thread->forum = $_GET['id'];
|
||||
$thread->owner = $user->id;
|
||||
$thread->title = $_POST['title'];
|
||||
|
||||
$thread->post($_POST['content']);
|
||||
|
||||
header('Location: thread.php?id='.$thread->id);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['authenticator']))
|
||||
header('Location: ../login_form.php');
|
||||
|
||||
doHeader('Forum');
|
||||
|
||||
$forum = getForum($_GET['id']);
|
||||
?>
|
||||
|
||||
<p>
|
||||
<span class="title"><?php echo $forum->title ?></span>
|
||||
<br><a href="index.php"><?php echo $cfg['sitename'] ?> Forum</a>
|
||||
</p>
|
||||
|
||||
<p style="text-align:center">
|
||||
<form action="post.php?id=<?php echo $_GET['id'] ?>" method="post">
|
||||
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th colspan="2">Post a New Thread / Question</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:150px"><b>Title</b></td>
|
||||
<td><input type="text" name="title" size="62"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top"><b>Message content</b></td>
|
||||
<td><textarea name="content" rows="12" cols="54"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:center">
|
||||
<input type="submit" value="Post message">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
doFooter();
|
||||
?>
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
require_once('../include.php');
|
||||
require_once('forum.inc');
|
||||
require_once('../util.inc');
|
||||
|
||||
if (!empty($_GET['id']) && !empty($_POST['content'])) {
|
||||
$_GET['id'] = stripslashes(strip_tags($_GET['id']));
|
||||
|
||||
//$user = getUserByAuth($_SESSION['authenticator']);
|
||||
$user = get_logged_in_user(true);
|
||||
|
||||
$thread = getThread($_GET['id']);
|
||||
$thread->reply($user->id, $_POST['content']);
|
||||
|
||||
header('Location: thread.php?id='.$thread->id);
|
||||
}
|
||||
|
||||
if (empty($_SESSION['authenticator']))
|
||||
header('Location: ../login_form.php');
|
||||
|
||||
doHeader('Forum');
|
||||
|
||||
$thread = getThread($_GET['id']);
|
||||
$forum = getForum($thread->forum);
|
||||
?>
|
||||
|
||||
<p>
|
||||
<span class="title"><?php echo $thread->title ?></span>
|
||||
<br><a href="index.php"><?php echo $cfg['sitename'] ?> Forum</a> -> <a href="forum.php?id=<?php echo $forum->id ?>"><?php echo $forum->title ?></a>
|
||||
</p>
|
||||
|
||||
<p style="text-align:center">
|
||||
<form action="reply.php?id=<?php echo $_GET['id'] ?>" method="post">
|
||||
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th colspan="2">Reply to Thread / Question</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top; width:150px"><b>Message content</b></td>
|
||||
<td><textarea name="content" rows="12" cols="54"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:center">
|
||||
<input type="submit" value="Post reply">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p style="text-align:center">
|
||||
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th style="width: 150px">Author</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$posts = $thread->getPosts();
|
||||
while ($post = getNextPost($posts)):
|
||||
$user = getUser($post->user);
|
||||
?>
|
||||
<tr style="vertical-align:top">
|
||||
<td>
|
||||
<p style="font-weight:bold">
|
||||
<a href="../view_profile.php?userid=<?php echo $post->user ?>"><?php echo $user->name ?></a>
|
||||
</p>
|
||||
<p style="font-size:8pt">
|
||||
Joined: <?php echo date('M j, Y', $user->create_time) ?>
|
||||
<br>Posts: <?php echo $user->posts ?>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p style="font-size:8pt">Posted: <?php echo date('D M j, Y g:i a', $post->timestamp) ?></p>
|
||||
<p><?php echo nl2br(stripslashes($post->content)) ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
|
||||
?>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
doFooter();
|
||||
?>
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
require_once('../include.php');
|
||||
require_once('forum.inc');
|
||||
doHeader('Forum');
|
||||
|
||||
/* sanitize variable */
|
||||
if (array_key_exists('id', $_GET))
|
||||
$_GET['id'] = stripslashes(strip_tags($_GET['id']));
|
||||
|
||||
$categories = getCategories();
|
||||
?>
|
||||
|
||||
<p>
|
||||
<span class="title">Search</span>
|
||||
<br><a href="index.php"><?php echo $cfg['sitename'] ?> Forum</a>
|
||||
</p>
|
||||
|
||||
<p style="text-align:center">
|
||||
<form action="post.php?id=<?php echo $_GET['id'] ?>" method="post">
|
||||
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th colspan="2">Search in Forum</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:150px"><b>Topic</b></td>
|
||||
<td><input type="text" name="topic" size="62"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align:top"><b>Message content</b></td>
|
||||
<td><textarea name="content" rows="12" cols="54"></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:center">
|
||||
<input type="submit" value="Post message">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
doFooter();
|
||||
?>
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
require_once('../include.php');
|
||||
require_once('forum.inc');
|
||||
doHeader('Forum');
|
||||
|
||||
/* sanitize variable */
|
||||
$_GET['id'] = stripslashes(strip_tags($_GET['id']));
|
||||
|
||||
$thread = getThread($_GET['id']);
|
||||
$thread->incView();
|
||||
|
||||
$forum = getForum($thread->forum);
|
||||
?>
|
||||
|
||||
<p>
|
||||
<span class="title"><?php echo $thread->title ?></span>
|
||||
<br><a href="index.php"><?php echo $cfg['sitename'] ?> Forum</a> -> <a href="forum.php?id=<?php echo $forum->id ?>"><?php echo $forum->title ?></a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="reply.php?id=<?php echo $_GET['id'] ?>">Reply to Thread / Question</a>
|
||||
</p>
|
||||
<p style="text-align:center">
|
||||
<table class="content" border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th style="width: 150px">Author</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$n = 0;
|
||||
$posts = $thread->getPosts();
|
||||
while ($post = getNextPost($posts)):
|
||||
$user = getUser($post->user);
|
||||
?>
|
||||
<tr class="row<?php echo (($n++)%2+1) ?>" style="vertical-align:top">
|
||||
<td>
|
||||
<p style="font-weight:bold">
|
||||
<?php if ($user->has_profile) { ?>
|
||||
<a href="../view_profile.php?userid=<?php echo $post->user ?>"><?php echo $user->name ?></a>
|
||||
<?php } else { echo $user->name; }?>
|
||||
</p>
|
||||
<p style="font-size:8pt">
|
||||
Joined: <?php echo date('M j, Y', $user->create_time) ?>
|
||||
<br>Posts: <?php echo $user->posts ?>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p style="font-size:8pt">Posted: <?php echo date('D M j, Y g:i a', $post->timestamp) ?></p>
|
||||
<p><?php echo nl2br(stripslashes($post->content)) ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endwhile;
|
||||
|
||||
?>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
doFooter();
|
||||
?>
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
$cfg['sitename'] = 'Astropulse';
|
||||
$cfg['root'] = '/ap';
|
||||
|
||||
$cfg['db']['host'] = '';
|
||||
$cfg['db']['user'] = '';
|
||||
$cfg['db']['password'] = '';
|
||||
$cfg['db']['database'] = 'ap';
|
||||
|
||||
?>
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
require_once('error.inc');
|
||||
|
||||
if(!@mysql_pconnect($cfg['db']['host'], $cfg['db']['user'], $cfg['db']['password']) || !@mysql_select_db($cfg['db']['database']))
|
||||
doError('The server is currently unavailable.');
|
||||
|
||||
function sql_query($sql) {
|
||||
if(!$result = mysql_query($sql))
|
||||
doError('A database error has occurred.<br>MySQL #'.mysql_errno().': '.mysql_error()."\n\nSQL: $sql");
|
||||
return $result;
|
||||
}
|
||||
|
||||
function sql_fetch_array($result) {
|
||||
return mysql_fetch_array($result);
|
||||
}
|
||||
|
||||
function sql_num_rows($result) {
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
function sql_insert_id() {
|
||||
return mysql_insert_id();
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
require_once('template.inc');
|
||||
|
||||
function doError($msg, $info = '') {
|
||||
doHeader('Error');
|
||||
|
||||
echo '<p class="title">'.$msg.'</p>';
|
||||
echo '<p>The error has been recorded, and the website administrator will investigate the issue as soon as possible. We sincerely apologize for the inconvenience.</p>';
|
||||
|
||||
doFooter();
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
function doHeader($caption) {
|
||||
?>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//Dtd HTML 4.01 Transitional//EN">
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title><?php echo $GLOBALS['cfg']['sitename'].' - '.$caption ?></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=<?php echo (!empty($_SESSION['lang']['charset']))?$_SESSION['lang']['charset']:'ISO-8859-1' ?>">
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['cfg']['root'] ?>/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<table class="frame" border="0" cellpadding="10" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
}
|
||||
|
||||
function doFooter() {
|
||||
?>
|
||||
<p style="text-align:center"><a href="http://maggie.ssl.berkeley.edu/ap">Return to <?php echo $GLOBALS['cfg']['sitename'] ?> Homepage</a></p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue