<?php
// (c) 2014 Trinity Desktop Project
// All Rights Reserved
// Authors: Elizabeth Liddell, Timothy Pearson, and Calvin Morrison
include("globals.php");
include("tde-head-and-foot.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();
?>