public function output() { global $date; $dd = date("l, F jS, Y", $date); $reldt = getRelativeDT($date, time()); $html = <<<EOD \t\t\t\t<div class="hdr btxt">Pickup Date <i style="font-size:12px;color:dimgray;">(Discuss a pickup time at your own discretion)</i></div> \t\t\t\t<div class="head">{$dd}</div> \t\t\t\t<div id="cntdwn" class="cdlt">{$reldt}</div> \t\t\t\t<div style="color:white;text-align:center;font-size:25px;" class="ltxt">until pickup</div> EOD; echo $html; }
public function output() { global $date; $dd = date("l, F jS, Y", $date); $reldt = getRelativeDT($date, time()); $html = <<<EOD \t\t\t\t<div class="hdr btxt">Meeting Date</div> \t\t\t\t<div class="head">{$dd}</div> \t\t\t\t<div id="cntdwn" class="cdlt">{$reldt}</div> \t\t\t\t<div style="color:white;text-align:center;font-size:25px;" class="ltxt">until meetup</div> EOD; echo $html; return; }
} else { foreach ($notifications as $notification) { ?> <div onclick="window.location='<?php echo "/{$notification['link']}&ref=n{$notification['id']}"; ?> '" class="notification"> <div class="content"> <div class="text"> <div class="title"><?php echo $notification["message"]; ?> </div> <div class="date"> <?php echo getRelativeDT(time(), $notification["date"]); ?> ago </div> </div> <div class="icon fa <?php echo $notification["read"] == 1 ? "uk-icon-circle-o" : "uk-icon-circle"; ?> " ></div> </div> </div> <?php } } ?> </div>
<li><span class='uk-icon-bolt'></span>eDart user #<?php echo $_GET["id"]; ?> </li> <li><span class='uk-icon-calendar'></span>Joined on <?php echo date("m/d/Y", $join_date); ?> </li> <?php echo !in_array("last_location", $privacy) && count($lastseen) != 0 ? "<li><span class='uk-icon-location-arrow'></span>Last seen near {$lastseen["properties"]["city"]}</li>" : ""; ?> <?php echo !in_array("gender", $privacy) && $gender_index != 0 ? "<li><span class='uk-icon-user'></span>{$gender}</li>" : ""; ?> <?php echo !in_array("dob", $privacy) && $dob != 0 ? "<li><span class='uk-icon-birthday-cake'></span>" . getRelativeDT(time(), $dob) . " old</li>" : ""; ?> <li><span class='uk-icon-institution'></span>Attends WPI</li> </ul> </div> </div> <?php if (isset($_SESSION["userid"]) && $_SESSION["userid"] == $_GET["id"]) { ?> <div class="uk-text-center"> <input type="button" id="edit_button" value="Edit Profile" data-link="edit_profile" class="uk-align-center small_text uk-button uk-width-1-1" value="Edit" /> </div> <div class="hidden">
for ($i = count($msg_br) - 1; $i >= 0; $i--) { $value = $msg_br[$i]; //Get each message as its own array $msg = trim($value["message"]); //Message content $aus = trim($value["user"]); //User ID $ts = trim($value["timestamp"]); //Timestamp //Get the user's info $authUser = new User(array("action" => "get", "id" => $aus)); $auInfo = $authUser->run(true); //Load their display name into one string $userDName = $auInfo[0]["fname"] . " " . $auInfo[0]["lname"]; //Get the relative time the message was posted $relDt = getRelativeDT(time(), $ts) . " ago"; //Get the HTML for the message $html = <<<EOD \t\t\t\t\t\t\t<div class="msg"> \t\t\t\t\t\t\t\t<div class="inner"> \t\t\t\t\t\t\t\t\t<div class="img_wrap"><a href="/profile.php?id={$aus}"><img class="pic" src="/profile.php?id={$aus}&load=image&size=small"></a></div> \t\t\t\t\t\t\t\t\t<div class="holder"> \t\t\t\t\t\t\t\t\t\t<div class="title"><a href="/profile.php?id={$aus}">{$userDName}</a></div> \t\t\t\t\t\t\t\t\t\t<div class="body">{$msg}</div> \t\t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t\t\t<div class="date">{$relDt}</div> \t\t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t</div>
?> "><?php echo "{$afname} {$alname}"; ?> </a></h1> <div id="uinfo"> Member since <?php echo date("F j, Y", $jdate); ?> <br/> <?php echo !is_array($agender) && !in_array("gender", $privacy) ? trim($agender) : ""; ?> <?php echo !is_array($adob) && trim($adob) != 0 && !in_array("dob", $privacy) ? ", " . trim(getRelativeDT(time(), $adob)) . " old<br/>" : ""; ?> </div> </div> </div> </div> </div> <div class="other"> <?php if (count($other_items) <= 1) { ?> <br><div style="font-size:14px;margin-left:25px;margin-bottom:20px;color:dimgray;">Nothing to show here!</div> <?php } else {
include_once $_SERVER["DOC_ROOT"] . "/scripts/php/core.php"; ?> <div id="recent_activity" class="profile_tab_content"> <?php $log = getRecentActivity($_GET["id"]); if (count($log) === 0) { ?> <h5>This user has no recent activity to display</h5> <?php } else { ?> <?php for ($i = 0; $i < count($log); $i++) { $regdate = date("Y-m-d H:i:s", $log[$i]["date"]); $reldate = getRelativeDT(time(), $log[$i]["date"]); $fulldte = date("l, F jS, Y", $log[$i]["date"]); ?> <div class="post"> <div title="<?php echo $fulldte; ?> " class="date"><?php echo $reldate; ?> ago</div> <a href="<?php echo $log[$i]["link"]; ?> "><?php echo $log[$i]["string"];
public function get($id) { global $con; $post_html = ""; $query = mysqli_query($con, "SELECT * FROM `feed` ORDER BY `date` DESC"); while ($post = mysqli_fetch_array($query)) { $getUser = new User(array("action" => "get", "id" => $post["usr"])); $userInfo = $getUser->run(true); $date_relative = getRelativeDT(time(), $post["date"]); if ($userInfo != 404) { $post_html .= <<<POST \t\t\t\t\t<div class="post hidden"> \t\t\t\t\t\t<div class="img"> \t\t\t\t\t\t\t<a href="/profile.php?id={$post["usr"]}"> \t\t\t\t\t\t\t\t<img alt="Profile Picture" src="/profile.php?id={$post["usr"]}&load=image&size=small" style="cursor:pointer;"> \t\t\t\t\t\t\t</a> \t\t\t\t\t\t</div> \t\t\t\t\t\t<div class="cocnt"> \t\t\t\t\t\t\t<div style="cursor:pointer;" class="hdr"> \t\t\t\t\t\t\t\t<a href="/profile.php?id={$post["usr"]}"> \t\t\t\t\t\t\t\t\t{$userInfo[0]["fname"]} {$userInfo[0]["lname"]} \t\t\t\t\t\t\t\t</a> \t\t\t\t\t\t\t</div> \t\t\t\t\t\t\t<div class="txt"> \t\t\t\t\t\t\t\t<a href="{$post["link"]}"> \t\t\t\t\t\t\t\t\t{$post["string"]} \t\t\t\t\t\t\t\t</a> \t\t\t\t\t\t\t</div> \t\t\t\t\t\t</div> \t\t\t\t\t\t<div class="date"> \t\t\t\t\t\t\t{$date_relative} ago \t\t\t\t\t\t</div> \t\t\t\t\t</div> POST; } } return str_replace("\t", "", str_replace("\n", "", $post_html)); }
<?php /* * Page Name: Relative Date * Purpose: Get the relative date given a timestamp * Last Updated: 6/6/2014 * Signature: Tyler Nickerson * Copyright 2014 eDart * * [Do not remove this header. One MUST be included at the start of every page/script] * */ //If a POST request was made... if (isset($_POST["d1"]) && $_POST["d2"]) { //...call the function echo getRelativeDT($_POST["d1"], $_POST["d2"]); } //Return the relative date function getRelativeDT($d1, $d2) { $d1s = $d1; //First timestamp $d2s = $d2; //Second timestamp $diff = abs($d1s - $d2s); //The difference between the two $sec = 1; //How many seconds are in a second $min = $sec * 60; //How many seconds are in a minute $hour = $min * 60;