summaryrefslogtreecommitdiffstats
path: root/news.php
blob: ef25704f099aa7548165925263cf883ffc65702e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
	// (c) 2014 Trinity Desktop Project
	// All Rights Reserved
	// Authors: Elizabeth Liddell, Timothy Pearson, and Calvin Morrison

	include("globals.php");
	include("header.php");
	include("footer.php");
	doHeader("Trinity News", "Main", "News");

	include ("media/news-javascript.php");
?>

<?php

if ($handle = opendir('./news/')) {
	$filenames = array();
	while ($file = readdir($handle)) {
		$filenames[] = $file;
	}
	rsort($filenames);

	foreach($filenames as $file) {
		// sort($handle, SORT_NUMERIC);
		if (($file != ".") && ($file != "..") && ($file{0} != '.')) {
			echo "<h3>$file: ";

			$data = file_get_contents("news/$file"); //read the file
			$data = str_replace("http://", "https://", $data); //force https images and links
			$convert = explode("\n", $data); //create array separate by new line
			for ($i=0;$i<count($convert);$i++) {
				echo $convert[$i]. '<br>'; //write value by index
				if ($i == 0){
					echo "</h3>";
				}
				if ($i == $newscollapsedlines) {
					echo '<div id="hiddennews-' . $file . '" style="display: none">';
				}
			}
			if (count($convert) > $newscollapsedlines) {
				echo '</div>';
				echo '<noscript><div class="floatleft"><a href=\'/newsentry.php?entry=' . $file . '\'>Read entire entry on separate page</a><BR>Javascript is not available or turned off</div></noscript>';
				echo '<div class="floatleft"><a id="hiddennews-toggler-' . $file . '" href="javascript:toggle(\'hiddennews-' . $file . '\',\'hiddennews-toggler-' . $file . '\');" >show all text of this entry</a></div>';
				echo '<div class="floatright"><a href=\'/newsentry.php?entry=' . $file . '\'>permalink</a></div>';
				echo '<div style="clear: both;"></div>';
			}
			else {
				echo '<div class="floatright"><a href=\'/newsentry.php?entry=' . $file . '\'>permalink</a></div>';
				echo '<div style="clear: both;"></div>';
			}
			echo "<div class=\"clearall\"></div><br><br>";
			echo "<p class=\"spacer\">";
		}
	}
	echo "<br>";
	closedir($handle);
}

?>

<?php
	doFooter();
?>