0,0 → 1,78 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
<html> |
<head> |
<title>phpSHOUT - Archive</title> |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
<link href="phpshoutstyle.css" rel="stylesheet" type="text/css"> |
</head> |
|
<body> |
<? |
include "config.php"; |
include "functions.php"; |
|
$numPerPage = $archivenoofposts; |
$filename = "messages.txt"; |
$handle = fopen($filename, "r"); |
$read = file_get_contents($filename); |
|
// create array elements by new lines |
$array = explode ("\n",$read); |
|
$page = isset($_GET['page']) ? $_GET['page'] : 1; |
|
$start = ($page-1) * $numPerPage; |
|
?> |
<table align="center" class="phpshout_table"> |
<? |
// start loop for each page |
for ($i=$start; $i<$start+$numPerPage; $i++) { |
|
// if there is a blank line. fixes offset error |
if ($array[$i] != NULL || $array[$i] != "") { |
|
list($name,$email,$msg) = explode ("\t", $array[$i]); |
|
if ($display_email == "1") { |
echo "<tr><td class=\"phpshout_posts\"><strong><a class=\"phpshout_link\" href=\"mailto:$email\">".wordwrap($name,18,"<br>\n",1)."</a> : </strong>"; |
$msg = smiles($msg); |
echo ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>"; |
} else if ($display_email == "0") { |
echo "<tr><td class=\"phpshout_posts\"><strong>".wordwrap($name,18,"<br>\n",1)." : </strong>"; |
$msg = smiles($msg); |
echo ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>"; |
} else { |
echo "Invalid display e-mail value. Please check your config.php file"; |
} |
//echo "<tr><td class=\"phpshout_posts\"><strong>".$name." : </strong>".$msg."</td></tr>"; |
|
} else { |
|
// stop loop |
break; |
|
} |
|
} |
?> |
<tr> |
<td class="phpshout_posts"> |
<? |
$totalPages = ceil(count($array) / $numPerPage); |
|
if ($page!=1) echo "<a class=\"phpshout_link\" href=".$_SERVER['PHP_SELF']."?page=".($page-1).">Previous</a> "; |
for ($i=1; $i<=$totalPages; $i++) { |
|
echo ($i==$page) ? $page.' ' : "<a class=\"phpshout_link\" href=".$_SERVER['PHP_SELF']."?page=".$i.">".$i."</a> "; |
|
} |
if ($page!=$totalPages) echo "<a class=\"phpshout_link\" href=".$_SERVER['PHP_SELF']."?page=".($page+1).">Next</a>"; |
|
fclose($handle); |
?> |
</td> |
</tr> |
</table> |
</body> |
</html> |