Subversion Repositories svnkaklik

Rev

Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
<html>
3
<head>
4
<title>phpSHOUT - Archive</title>
5
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
<link href="phpshoutstyle.css" rel="stylesheet" type="text/css">
7
</head>
8
 
9
<body>
10
<?
11
	include "config.php";
12
	include "functions.php";
13
 
14
	$numPerPage = $archivenoofposts;
15
	$filename = "messages.txt";
16
	$handle = fopen($filename, "r");
17
	$read =	file_get_contents($filename);
18
 
19
	// create array elements by new lines
20
	$array = explode ("\n",$read);
21
 
22
	$page = isset($_GET['page']) ? $_GET['page'] : 1;
23
 
24
	$start = ($page-1) * $numPerPage;
25
 
26
	?>
27
	<table align="center" class="phpshout_table">
28
	<?
29
	// start loop for each page
30
	for ($i=$start; $i<$start+$numPerPage; $i++) {		
31
 
32
		// if there is a blank line. fixes offset error
33
		if ($array[$i] != NULL || $array[$i] != "") {
34
 
35
			list($name,$email,$msg) = explode ("\t", $array[$i]);
36
 
37
			if ($display_email == "1") {
38
				echo "<tr><td class=\"phpshout_posts\"><strong><a class=\"phpshout_link\" href=\"mailto:$email\">".wordwrap($name,18,"<br>\n",1)."</a> : </strong>";
39
				$msg = smiles($msg);
40
				echo ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>";
41
			} else if ($display_email == "0") {
42
				echo "<tr><td class=\"phpshout_posts\"><strong>".wordwrap($name,18,"<br>\n",1)." : </strong>";
43
				$msg = smiles($msg);
44
				echo ereg_replace("([^ \/]{22})","\\1<wbr>",$msg)."</td></tr>";
45
			} else {
46
				echo "Invalid display e-mail value. Please check your config.php file";
47
			}
48
			//echo "<tr><td class=\"phpshout_posts\"><strong>".$name." : </strong>".$msg."</td></tr>";
49
 
50
		} else {
51
 
52
		// stop loop
53
			break;
54
 
55
		}		
56
 
57
	}
58
	?>
59
	<tr>
60
	<td class="phpshout_posts">
61
	<?
62
	$totalPages = ceil(count($array) / $numPerPage);
63
 
64
	if ($page!=1) echo "<a class=\"phpshout_link\" href=".$_SERVER['PHP_SELF']."?page=".($page-1).">Previous</a> ";
65
	for ($i=1; $i<=$totalPages; $i++) {
66
 
67
    echo ($i==$page) ? $page.' ' : "<a class=\"phpshout_link\" href=".$_SERVER['PHP_SELF']."?page=".$i.">".$i."</a> ";
68
 
69
	}
70
	if ($page!=$totalPages) echo "<a class=\"phpshout_link\" href=".$_SERVER['PHP_SELF']."?page=".($page+1).">Next</a>";
71
 
72
	fclose($handle);
73
	?>
74
	</td>
75
	</tr>
76
	</table>
77
</body>
78
</html>