|
@@ -1,13 +1,5 @@
|
|
|
-<!--Scripts below allow audio player JS to show up with fancy little player-->
|
|
|
|
|
-<script type="text/javascript" src="sys/fileshare/include/audio-player.js"></script>
|
|
|
|
|
-<script type="text/javascript">
|
|
|
|
|
- AudioPlayer.setup("sys/fileshare/include/player.swf", {
|
|
|
|
|
- width: 290,
|
|
|
|
|
- transparentpagebg: "yes",
|
|
|
|
|
- });
|
|
|
|
|
-</script>
|
|
|
|
|
<?php
|
|
<?php
|
|
|
- if ($editable) {
|
|
|
|
|
|
|
+ if ($editable) { //Insert the Only JS the project should have, all it does is toggle a div
|
|
|
echo "
|
|
echo "
|
|
|
<script type=\"text/javascript\">
|
|
<script type=\"text/javascript\">
|
|
|
function switchMenu(obj) {
|
|
function switchMenu(obj) {
|
|
@@ -25,26 +17,19 @@
|
|
|
//Set important times - $tdtime is today's date, $oldtime is the oldest known date a tCMS install had nuze for - defaults to today then searches microblog dir for entries to set date
|
|
//Set important times - $tdtime is today's date, $oldtime is the oldest known date a tCMS install had nuze for - defaults to today then searches microblog dir for entries to set date
|
|
|
$tdtime = new DateTime(null, new DateTimeZone($timezone));
|
|
$tdtime = new DateTime(null, new DateTimeZone($timezone));
|
|
|
$oldtime = clone $tdtime;
|
|
$oldtime = clone $tdtime;
|
|
|
- //limit results of directory read to first entry
|
|
|
|
|
- function &oldtimer($timezone, $basedir, $microblogdir) {
|
|
|
|
|
- if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$basedir.$microblogdir)) {
|
|
|
|
|
- while (false !== ($entry = readdir($handle))) {
|
|
|
|
|
- if ($entry != "." && $entry != "..") {
|
|
|
|
|
- $oldtime = DateTime::createFromFormat('m.d.y', $entry, new DateTimeZone ($timezone));
|
|
|
|
|
- closedir($handle);
|
|
|
|
|
- return($oldtime);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
- $oldtime = &oldtimer($timezone, $basedir, $microblogdir);
|
|
|
|
|
|
|
+ //limit results of directory read to first entry -- much faster than doing it with PHP once you get a large filelist.
|
|
|
|
|
+ exec("ls -tr1 ".$_SERVER["DOCUMENT_ROOT"].'/'.$basedir.$microblogdir." |head -1", $cmd_out);
|
|
|
|
|
+ if(!empty($cmd_out[0])) {
|
|
|
|
|
+ $oldtime = $oldtime = DateTime::createFromFormat('m.d.y', $cmd_out[0], new DateTimeZone($timezone));
|
|
|
|
|
+ }
|
|
|
$oldtime->sub(new DateInterval('P1D'));
|
|
$oldtime->sub(new DateInterval('P1D'));
|
|
|
- //$today and $tmrw refer to times relative to what is passed by GET params - $today is the date requested by GET, $tmrw is bool designating whether $today is something other than $tdtime
|
|
|
|
|
- //error indicates whether you supplied a bogus GET param for date.
|
|
|
|
|
|
|
+ /*$today and $tmrw refer to times relative to what is passed by GET params -
|
|
|
|
|
+ $today is the date requested by GET, $tmrw is bool designating whether $today is something other than $tdtime
|
|
|
|
|
+ error indicates whether you supplied a bogus GET param for date.*/
|
|
|
$tmrw = 0;
|
|
$tmrw = 0;
|
|
|
$error = 0;
|
|
$error = 0;
|
|
|
$today = clone $tdtime;
|
|
$today = clone $tdtime;
|
|
|
- if ($_GET["date"] != "") {
|
|
|
|
|
|
|
+ if(!empty($_GET["date"])) {
|
|
|
$today = DateTime::createFromFormat('m.d.y', $_GET["date"], new DateTimeZone ($timezone));
|
|
$today = DateTime::createFromFormat('m.d.y', $_GET["date"], new DateTimeZone ($timezone));
|
|
|
//Catch bogus input, set $tmwr to TRUE if $today was set to something other than today's date
|
|
//Catch bogus input, set $tmwr to TRUE if $today was set to something other than today's date
|
|
|
if (!filter_var($_GET["date"],FILTER_VALIDATE_REGEXP,array('options' => array('regexp' => "/^(0[1-9]|1[012])[.](0[1-9]|[12][0-9]|3[01])[.]\d\d/")))) {
|
|
if (!filter_var($_GET["date"],FILTER_VALIDATE_REGEXP,array('options' => array('regexp' => "/^(0[1-9]|1[012])[.](0[1-9]|[12][0-9]|3[01])[.]\d\d/")))) {
|
|
@@ -59,13 +44,18 @@
|
|
|
$tmrw = 1;
|
|
$tmrw = 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //Catch if day in question has no news - If not, display day before (or before that if still no news. $oldtime used here to tell when to stop looping back)
|
|
|
|
|
|
|
+ /*Catch if day in question has no news -
|
|
|
|
|
+ If not, display day before (or before that if still no news.
|
|
|
|
|
+ $oldtime used here to tell when to stop looping back)*/
|
|
|
if (!$error) {
|
|
if (!$error) {
|
|
|
while (empty($todaysnews)) {
|
|
while (empty($todaysnews)) {
|
|
|
- $yesterday = clone $today;
|
|
|
|
|
- $yesterday->sub(new DateInterval('P1D'));
|
|
|
|
|
- //Detect if We're at the end of postings
|
|
|
|
|
- if ($yesterday < $oldtime) {
|
|
|
|
|
|
|
+ $todaysnews = ""; //Set it to be something empty to prevent logspam
|
|
|
|
|
+ $yesterday = clone $today;//This may look strange, but it'll make sense later
|
|
|
|
|
+ $tomorrow = clone $today;
|
|
|
|
|
+ $tomorrow->add(new DateInterval('P1D'));
|
|
|
|
|
+ $yesterday->sub(new DateInterval('P1D'));
|
|
|
|
|
+ //Detect if We're at the end of postings
|
|
|
|
|
+ if ($yesterday < $oldtime) {
|
|
|
echo " (".$today->format('m.d.y')."):</p><hr />";
|
|
echo " (".$today->format('m.d.y')."):</p><hr />";
|
|
|
echo "For me, it was a beginning, but for you it is the end of the road.<br /><hr />\n";
|
|
echo "For me, it was a beginning, but for you it is the end of the road.<br /><hr />\n";
|
|
|
if ($oldtime != $tdtime) {
|
|
if ($oldtime != $tdtime) {
|
|
@@ -76,11 +66,15 @@
|
|
|
$todaysnews = "end";
|
|
$todaysnews = "end";
|
|
|
}
|
|
}
|
|
|
if ($todaysnews != "end") {
|
|
if ($todaysnews != "end") {
|
|
|
- //Get news from directory if any exists for that day
|
|
|
|
|
|
|
+ //Get news from directory if any exists for that day, glob will return empty if nothing is in dir
|
|
|
$todaysnews = glob($_SERVER["DOCUMENT_ROOT"].'/'.$basedir.$microblogdir.$today->format('m.d.y')."/*");
|
|
$todaysnews = glob($_SERVER["DOCUMENT_ROOT"].'/'.$basedir.$microblogdir.$today->format('m.d.y')."/*");
|
|
|
//Set display date for today's news, set $today to be yesterday in order to get while loop to recurse correctly
|
|
//Set display date for today's news, set $today to be yesterday in order to get while loop to recurse correctly
|
|
|
$realtime = $today->format('m.d.y');
|
|
$realtime = $today->format('m.d.y');
|
|
|
- $today = clone $yesterday;
|
|
|
|
|
|
|
+ if(!empty($_GET['fwd']) && $_GET['fwd']) {//Check whether we are traversing forward or backward in time
|
|
|
|
|
+ $today = clone $tomorrow;
|
|
|
|
|
+ } else { //Default to going back
|
|
|
|
|
+ $today = clone $yesterday;
|
|
|
|
|
+ }
|
|
|
//Finish by setting times for Yesterday and Tomorrow so that they can be used in links below
|
|
//Finish by setting times for Yesterday and Tomorrow so that they can be used in links below
|
|
|
$tomorrow = clone $yesterday;
|
|
$tomorrow = clone $yesterday;
|
|
|
$tomorrow->add(new DateInterval('P2D'));
|
|
$tomorrow->add(new DateInterval('P2D'));
|
|
@@ -97,27 +91,27 @@
|
|
|
$json = json_decode($fc);
|
|
$json = json_decode($fc);
|
|
|
if(is_null($json)) {
|
|
if(is_null($json)) {
|
|
|
echo $fc;
|
|
echo $fc;
|
|
|
- } elseif (isset($json->title) && isset($json->url) && isset($json->poster)) {
|
|
|
|
|
|
|
+ } elseif (!empty($json->title) && !empty($json->url) && !empty($json->poster)) {
|
|
|
$out = '<h3 class="blogtitles">
|
|
$out = '<h3 class="blogtitles">
|
|
|
<a href="'.$json->url.'">'.$json->title.'</a>
|
|
<a href="'.$json->url.'">'.$json->title.'</a>
|
|
|
<a class="usericon '.$json->poster.'" title="Posted by '.$json->poster.'"></a>
|
|
<a class="usericon '.$json->poster.'" title="Posted by '.$json->poster.'"></a>
|
|
|
</h3>';
|
|
</h3>';
|
|
|
- if(isset($json->image)) {
|
|
|
|
|
|
|
+ if(!empty($json->image)) {
|
|
|
$out .= '<img class="mblogimg" src="'.$json->image.'" />';
|
|
$out .= '<img class="mblogimg" src="'.$json->image.'" />';
|
|
|
}
|
|
}
|
|
|
- if(isset($json->audio)) {
|
|
|
|
|
|
|
+ if(!empty($json->audio)) {
|
|
|
$out .= '<audio src="'.$json->audio.'" controls>
|
|
$out .= '<audio src="'.$json->audio.'" controls>
|
|
|
Download Audio
|
|
Download Audio
|
|
|
<a href="'.$json->audio.'">Here</a><br />
|
|
<a href="'.$json->audio.'">Here</a><br />
|
|
|
</audio>';
|
|
</audio>';
|
|
|
}
|
|
}
|
|
|
- if(isset($json->video)) {
|
|
|
|
|
|
|
+ if(!empty($json->video)) {
|
|
|
$out .= '<video src="'.$json->video.'" controls>
|
|
$out .= '<video src="'.$json->video.'" controls>
|
|
|
Download Video
|
|
Download Video
|
|
|
<a href="'.$json->video.'">Here</a><br />
|
|
<a href="'.$json->video.'">Here</a><br />
|
|
|
</video>';
|
|
</video>';
|
|
|
}
|
|
}
|
|
|
- if(isset($json->comment)) {
|
|
|
|
|
|
|
+ if(!empty($json->comment)) {
|
|
|
$out .= $json->comment;
|
|
$out .= $json->comment;
|
|
|
}
|
|
}
|
|
|
$out .= '<hr />';
|
|
$out .= '<hr />';
|
|
@@ -125,14 +119,24 @@
|
|
|
} #Note that if nothing works out here, I'm just opting not to show anything.
|
|
} #Note that if nothing works out here, I'm just opting not to show anything.
|
|
|
if ($editable) {
|
|
if ($editable) {
|
|
|
$id=basename($i);
|
|
$id=basename($i);
|
|
|
- echo "
|
|
|
|
|
|
|
+ $editblock = "
|
|
|
<a style=\"display: inline-block;\" onclick=\"switchMenu('$id');\">[Edit]</a>
|
|
<a style=\"display: inline-block;\" onclick=\"switchMenu('$id');\">[Edit]</a>
|
|
|
<div style=\"display: none;\" id=\"$id\">
|
|
<div style=\"display: none;\" id=\"$id\">
|
|
|
<form style=\"display: inline\" method=\"POST\">
|
|
<form style=\"display: inline\" method=\"POST\">
|
|
|
<input type=\"hidden\" name=\"id\" value=\"$i\" />
|
|
<input type=\"hidden\" name=\"id\" value=\"$i\" />
|
|
|
- <input type='hidden' name='action' value='Edit' />
|
|
|
|
|
- <textarea class=\"mbedit_text\" name=\"content\">$fc</textarea>
|
|
|
|
|
- <input class=\"coolbutton mbedit_button\" type=\"submit\" Value=\"Edit\" />
|
|
|
|
|
|
|
+ <input type='hidden' name='action' value='Edit' />";
|
|
|
|
|
+ if(is_null($json)) {
|
|
|
|
|
+ $editblock .= "<textarea class=\"mbedit_text\" name=\"content\">$fc</textarea>";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $editblock .= '<input type="hidden" name="type" value="JSON" />
|
|
|
|
|
+ Title: <input class="cooltext" type="text" name="title" value="'.$json->title.'" /><br />
|
|
|
|
|
+ URL: <input class="cooltext" type="text" name="URL" value="'.$json->url.'" /><br />
|
|
|
|
|
+ Image: <input class="cooltext" type="text" name="IMG" value="'.$json->image.'" /><br />
|
|
|
|
|
+ Audio: <input class="cooltext" type="text" name="AUD" value="'.$json->audio.'" /><br />
|
|
|
|
|
+ Video: <input class="cooltext" type="text" name="VID" value="'.$json->video.'" /><br />
|
|
|
|
|
+ Comments: <textarea class="cooltext" name="comment">'.$json->comment.'</textarea>';
|
|
|
|
|
+ }
|
|
|
|
|
+ $editblock .= "<input class=\"coolbutton mbedit_button\" type=\"submit\" Value=\"Edit\" />
|
|
|
</form>
|
|
</form>
|
|
|
<form style=\"display: inline\" method=\"POST\">
|
|
<form style=\"display: inline\" method=\"POST\">
|
|
|
<input type=\"hidden\" name=\"id\" value=\"$i\" />
|
|
<input type=\"hidden\" name=\"id\" value=\"$i\" />
|
|
@@ -141,13 +145,13 @@
|
|
|
</form>
|
|
</form>
|
|
|
</div>
|
|
</div>
|
|
|
<hr class=\"clear\" />";
|
|
<hr class=\"clear\" />";
|
|
|
|
|
+ echo $editblock;
|
|
|
}
|
|
}
|
|
|
- echo "\n";
|
|
|
|
|
}
|
|
}
|
|
|
- echo "<a style=\"float: left;\" title=\"skips empty days\" href=\"".$_SERVER["PHP_SELF"]."?nav=2&date=".$yesterday."\">Yesterday's News</a>\n";
|
|
|
|
|
|
|
+ echo "<a style=\"float: left;\" title=\"skips empty days\" href=\"?nav=2&date=".$yesterday."&fwd=0\">Older Entries</a>\n";
|
|
|
}
|
|
}
|
|
|
if ($tmrw) {
|
|
if ($tmrw) {
|
|
|
- echo "<a style=\"float: right;\" href=\"".$_SERVER["PHP_SELF"]."?nav=2&date=".$tomorrow."\">Tomorrow's News</a>\n";
|
|
|
|
|
|
|
+ echo "<a style=\"float: right;\" href=\"?nav=2&date=".$tomorrow."&fwd=1\">Newer Entries</a>\n";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|