function saveComment($name, $hour, $mycomment)
{
    $atime = timeAgo($hour);
    $putComment = $name . ' | ' . $mycomment . ' | ' . $atime;
    $filename = $hour . ".comment";
    file_put_contents($filename, $putComment);
}
Example #2
0
 public function bitsList($bits)
 {
     $html = '<ul>';
     $count = 2;
     foreach ($bits as $bit) {
         $settings = json_decode($bit->meta);
         $sampleCode = $bit->javascript ? $bit->javascript : ($bit->html ? $bit->html : ($bit->css ? $bit->css : false));
         if ($sampleCode) {
             $compressed = preg_replace("/\n/", '', preg_replace("/\t/", '', substr(base64_decode($sampleCode), 0, 200)));
             $sampleCode = '<pre class="sample-code">' . _html($compressed) . '</pre>';
         } else {
             $sampleCode = '';
         }
         if ($settings->bit_description) {
             $sampleCode = '<pre class="sample-code">' . _html($settings->bit_description) . '</pre>';
         }
         $klass = $count % 2 == 0 ? 'even' : 'odd';
         $html .= '<li class="' . $klass . '"><a href="' . home_url('code/bit/' . $bit->slug . '/' . $bit->latestVersion) . '" class="block-link">';
         $html .= '<div class="bit-title group">';
         $html .= '<p class="pull-left code-font">' . $settings->bit_title . ' <span>v' . $bit->latestVersion . '</span></p>';
         $html .= '<time class="pull-right" datetime="' . $bit->created . '">' . timeAgo($bit->created) . '</time>';
         $html .= '</div>';
         $html .= '<div class="bit-sample">';
         $html .= $sampleCode;
         $html .= '</div>';
         $html .= '</a></li>';
         $count++;
     }
     $html .= '</ul>';
     return $html;
 }
Example #3
0
 public function displayLastCheckin()
 {
     if ($this->lastCheckInTime != null) {
         echo timeAgo($this->lastCheckInTime);
     } else {
         echo "unknown";
     }
 }
function jsonTimestampOut($lastupdate, $offset = 0, $lang, $callback)
{
    if ($lastupdate) {
        header("Content-Type: text/plain; charset=UTF-8");
        $difference = timeAgo(time(), $lastupdate, $offset);
        $jsonData = json_encode(array('timestamp' => array('unix' => substr($lastupdate, 0, -1), 'string' => timestampString($lastupdate, $offset)), 'difference' => array('unix' => $difference, 'lang' => $lang, 'string' => timeAgoString($difference))));
        // JSONP request?
        if (isset($callback)) {
            return $callback . '(' . $jsonData . ')';
        } else {
            return $jsonData;
        }
    }
    return false;
}
Example #5
0
 function processPost($post)
 {
     global $MStudent;
     $student = $MStudent->getById($post['from']);
     $post['pic'] = $student['photo'];
     $post['name'] = $student['name'];
     $post['date'] = timeAgo($post['date']);
     $post['id'] = $post['id']->{'$id'};
     if ($post['parent'] != '') {
         $post['parent'] = $post['parent']->{'$id'};
     }
     $post['liked'] = false;
     foreach ($post['likes'] as $key => &$sub_array) {
         if ($sub_array['id'] == $post['from']) {
             $post['liked'] = true;
             break;
         }
     }
     $post['content'] = nl2br(autolink($post['content']));
     return $post;
 }
Example #6
0
						$color = '#2B5B6A;';
					?>

					<div class="panel panel-default">
						<div class="panel-heading" style="background: <?=$color; ?>">
							<?php
							if ($newsItem['type'] === 'edited_description') {
								echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\">{$newsItem['username']}</a>"; ?> ändrade gruppens beskrivning.
							<?php }
							if ($newsItem['type'] === 'group_created') {
								echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\">{$newsItem['username']}</a>"; ?> skapade gruppen.
							<?php }
							if ($newsItem['type'] === 'invited') {
								$json = json_decode($newsItem['what'], true);
								echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\">{$newsItem['username']}</a>"; ?> bjöd in <a href="profile?view=<?=$json['id']; ?> " style="color: #FFFFFF;"><?=$json['username']; ?></a>.
							<?php }
							if ($newsItem['type'] === 'invite_request') { ?>
								<a href="profile?view={$newsItem['user_id']}" style="color: #FFFFFF;"><?=$newsItem['username']; ?></a> vill gå med i gruppen.
								<div class="panel-body">
									<button class="btn btn-info" onClick="window.location.replace('groups?view=<?=$_GET['view']; ?>&show=invite&requests');">Hantera</button>
								</div>
							<?php }
							if ($newsItem['type'] === 'rejected_invite') {
								echo ($newsItem['user_id'] == $_SESSION['user']['id']) ? 'Jag' : "<a href=\"profile?view={$newsItem['user_id']}\" style=\"color: #FFFFFF;\">{$newsItem['username']}</a>"; ?> ignorerade inbjudan.
							<?php } ?>
						</div>
						<div class="panel-footer">
							<?=timeAgo($newsItem['date']); ?>
						</div>
					</div>
					<?php } ?>
Example #7
0
function getLatestTweets($count = 1)
{
    $consumerKey = get_field('twitter_consumer_key', 'option');
    $consumerSecret = get_field('twitter_consumer_secret', 'option');
    $accessToken = get_field('twitter_access_token', 'option');
    $accessSecret = get_field('twitter_access_token_secret', 'option');
    $connection = new TwitterOAuth($consumerKey, $consumerSecret, $accessToken, $accessSecret);
    $tweetData = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=atticoos&count={$count}");
    $tweets = array();
    foreach ($tweetData as $tweet) {
        $replace_index = array();
        if (!empty($tweet->entities)) {
            foreach ($tweet->entities as $area => $items) {
                switch ($area) {
                    case 'hashtags':
                        $find = 'text';
                        $prefix = '#';
                        $url = 'https://twitter.com/search/?src=hash&q=%23';
                        break;
                    case 'user_mentions':
                        $find = 'screen_name';
                        $prefix = '@';
                        $url = 'https://twitter.com/';
                        break;
                    case 'media':
                    case 'urls':
                        $find = 'display_url';
                        $prefix = '';
                        $url = '';
                        break;
                    default:
                        break;
                }
                foreach ($items as $item) {
                    $text = $tweet->text;
                    $string = $item->{$find};
                    $href = $url . $string;
                    if (!(strpos($href, 'http://') === 0) && !(strpos($href, 'https://') === 0)) {
                        $href = 'http://' . $href;
                    }
                    $replace = substr($text, $item->indices[0], $item->indices[1] - $item->indices[0]);
                    $with = "<a href=\"{$href}\" target=\"_blank\">{$prefix}{$string}</a>";
                    $replace_index[$replace] = $with;
                }
            }
            foreach ($replace_index as $replace => $with) {
                $tweet->text = str_replace($replace, $with, $tweet->text);
            }
        }
        $tweets[] = array('user' => $tweet->user, 'id' => $tweet->id, 'text' => $tweet->text, 'createdat' => $tweet->created_at, 'timeago' => timeAgo(strtotime($tweet->created_at)));
    }
    return $tweets;
}
 /**
  * Echoes the stats of the cache.
  *
  * Gives the cache hits, cache misses and cache uptime.
  *
  * @since 6.2.0
  */
 public function getStats()
 {
     if (!$this->enable) {
         return false;
     }
     echo "<p>";
     echo "<strong>" . _t('Cache Hits:') . "</strong> " . _file_get_contents($this->_dir . 'cache_hits.txt') . "<br />";
     echo "<strong>" . _t('Cache Misses:') . "</strong> " . _file_get_contents($this->_dir . 'cache_misses.txt') . "<br />";
     echo "<strong>" . _t('Uptime:') . "</strong> " . timeAgo(file_mod_time($this->_dir)) . "<br />";
     echo "</p>";
 }
 /**
  * getDataSourceLogs
  * @author Minh Duc Nguyen <*****@*****.**>
  * @param [POST] data_source_id [POST] offset [POST] count [POST] log_id
  * 
  * @return [json] [logs for the data source]
  */
 public function getDataSourceLogs()
 {
     header('Cache-Control: no-cache, must-revalidate');
     header('Content-type: application/json');
     // date_default_timezone_set('Australia/Canberra');//???
     $this->load->model('data_sources', 'ds');
     $post = $this->input->post();
     $id = isset($post['id']) ? $post['id'] : 0;
     //data source id
     if ($id == 0) {
         throw new Exception('Data Source ID must be provided');
         exit;
     }
     $offset = isset($post['offset']) ? (int) $post['offset'] : 0;
     $count = isset($post['count']) ? (int) $post['count'] : 10;
     $logid = isset($post['logid']) ? (int) $post['logid'] : null;
     $log_class = isset($post['log_class']) ? $post['log_class'] : 'all';
     $log_type = isset($post['log_type']) ? $post['log_type'] : 'all';
     $jsonData = array();
     $dataSource = $this->ds->getByID($id);
     $dataSourceLogs = $dataSource->get_logs($offset, $count, $logid, $log_class, $log_type);
     $jsonData['log_size'] = $dataSource->get_log_size($log_type);
     if ($jsonData['log_size'] > $offset + $count) {
         $jsonData['next_offset'] = $offset + $count;
         $jsonData['hasMore'] = true;
     } else {
         $jsonData['next_offset'] = 'all';
         $jsonData['hasMore'] = false;
     }
     $jsonData['last_log_id'] = '';
     $lastLogIdSet = false;
     $items = array();
     if (sizeof($dataSourceLogs) > 0) {
         foreach ($dataSourceLogs as $log) {
             $item = array();
             $item['type'] = $log['type'];
             $item['log_snippet'] = first_line($log['log']);
             $item['log'] = $log['log'];
             $item['id'] = $log['id'];
             if (!$lastLogIdSet) {
                 $jsonData['last_log_id'] = $log['id'];
                 $lastLogIdSet = true;
             }
             $item['date_modified'] = timeAgo($log['date_modified']);
             $item['harvester_error_type'] = $log['harvester_error_type'];
             if ($log['harvester_error_type'] != 'BENCHMARK_INFO' || $this->user->hasFunction(AUTH_FUNCTION_SUPERUSER)) {
                 array_push($items, $item);
             }
         }
     }
     $jsonData['count'] = $count;
     $jsonData['items'] = $items;
     echo json_encode($jsonData);
 }
Example #10
0
 function viewData($c, $entry = NULL)
 {
     global $MMessage;
     $messages = array_reverse(iterator_to_array($MMessage->findByParticipant($_SESSION['_id']->{'$id'})));
     $replies = array();
     $unread = 0;
     foreach ($messages as $m) {
         $reply = array_pop($m['replies']);
         $reply['_id'] = $m['_id'];
         $from = $reply['from'];
         if (!$reply['read']) {
             $reply['read'] = strcmp($from, $_SESSION['_id']) == 0;
         }
         if (!$reply['read']) {
             $unread++;
         }
         $c->setFromNamePic($reply, $from);
         if (strcmp($m['_id'], $entry['_id']) == 0) {
             $reply['current'] = true;
         } else {
             $reply['current'] = false;
         }
         $reply['time'] = timeAgo($reply['time']);
         if (strlen($reply['msg']) > 100) {
             $reply['msg'] = substr($reply['msg'], 0, 97) . '...';
         }
         array_push($replies, $reply);
     }
     // Handle current message
     if (!is_null($entry)) {
         $currentreplies = $entry['replies'];
         $current = array();
         foreach ($currentreplies as $m) {
             $c->setFromNamePic($m, $m['from']);
             $m['time'] = timeAgo($m['time']);
             array_push($current, $m);
         }
         $to = 'Message To: ' . $c->getName($entry['participants'][0]);
         foreach ($entry['participants'] as $p) {
             if (strcmp($p, $_SESSION['_id']) != 0) {
                 $to = 'Message To: ' . $c->getName($p);
             }
         }
         $currentid = $entry['_id'];
     } else {
         $current = null;
         $currentid = null;
         $to = '';
     }
     $data = array('messages' => $replies, 'current' => $current, 'currentid' => $currentid, 'unread' => $unread, 'to' => $to);
     if (isset($_GET['msg'])) {
         $data['msg'] = $_GET['msg'];
     }
     return $data;
 }
Example #11
0



<?php 
    foreach ($answers as $answer) {
        ?>

<div class="questionsview_userbox">
<?php 
        echo getUser($answer['userid']);
        ?>
</div>

<div class="questionsview_details"><span style="color:#999"><?php 
        echo timeAgo(strtotime($answer['created']));
        ?>
</span>
</div>

<?php 
        if ($answer['userid'] == $_SESSION['userid']) {
            ?>
<div class="questionsview_options"><a href="<?php 
            echo basePath();
            ?>
/answers/edit/<?php 
            echo $answer['id'];
            ?>
">edit</a></div>
<?php 
Example #12
0
img/avatar04.png" alt="Avatar Image" >
								</a>
								 <p style="float:right; text-align:right; font-size:10px;"><a href="javascript:;" rel="<?php 
        echo $post_id;
        ?>
" class="comment-delete" id="comment_delete_<?php 
        echo $comment_id;
        ?>
">X</a></p>
								</div>
								<div class="acomment-meta">
								<a href="#" ><?php 
        echo $fulln;
        ?>
</a>  <?php 
        echo timeAgo($comt['commented_date']);
        ?>
 
								</div>
								<div class="acomment-content"><p class="msg_wrap"><?php 
        echo parse_smileys(make_clickable(nl2br(stripslashes($comt['comment']))), $smiley_folder);
        ?>
</p></div></li>
								<?php 
    }
    ?>
								</ul>
								<?php 
    if ($total_topics == 0) {
        ?>
								<!--- Topic Code  --->
Example #13
0
    echo $repo->html_url;
    ?>
"><?php 
    echo $repo->name;
    ?>
</a> <small><?php 
    echo $repo->collaborator_count;
    ?>
 Contributors</small>
								</h2>
								<p><?php 
    echo $repo->description;
    ?>
</p>
								<p><?php 
    echo "Last updated " . timeAgo($repo->pushed_at);
    ?>
</p>
							</div>
						</div>
<?php 
}
?>

</div>
				</div>
			</div>
		</div>
		<?php 
$this->load->view('include/social_sidebar.php');
?>
Example #14
0
"
		<?php 
        }
        ?>
 alt="user photo" class="media-object img-circle width-50" style="height: 50px;" />
                    </div>
                    <div class="media-body message">
                      <h4 class="text-subhead margin-none"><a href="user_view?username=<?php 
        echo $row['sender'];
        ?>
"><?php 
        echo $row['sender'];
        ?>
</a></h4>
                      <p class="text-caption text-light"><i class="fa fa-clock-o"></i> <?php 
        echo timeAgo($row['time']);
        ?>
</p>
                    </div>
                  </div>
                  <p><?php 
        echo $row['message'];
        ?>
</p>
                </div>
              </div>
	<?php 
    }
    //end of while loop
} else {
    ?>
Example #15
0
/**
 * Creates an array of posts in a format to print on the page given a mysql
 * reponse of posts.
 */
function formPosts($rows)
{
    $posts = [];
    foreach ($rows as $row) {
        $users = Lib::query("SELECT * FROM users WHERE id = ?", $row["user_id"]);
        $user = $users[0];
        //first and only user
        $votes = Lib::query("SELECT * FROM votes WHERE post_id = ?", $row["id"]);
        $numberLikes = count($votes);
        $userVotes = Lib::query("SELECT * FROM votes WHERE post_id = ? AND user_id = ?", $row["id"], $_SESSION["id"]);
        $liked = false;
        if (count($userVotes) == 1) {
            $liked = true;
        }
        $topics = Lib::query("SELECT * FROM topics WHERE id = ?", $row["topic_id"]);
        $topic = $topics[0];
        $posts[] = ["id" => $row["id"], "user" => $user, "date" => timeAgo(strtotime($row["date"])), "text" => $row["text"], "likes" => $numberLikes, "liked" => $liked, "topic" => $topic];
    }
    return $posts;
}
				<a href="<?php 
        echo registry_url('registry_object/view/' . $record->registry_object_id);
        ?>
">
					<img class="class_icon pull-left" style="width:20px;padding-right:10px;" src="<?php 
        echo registry_url('assets/img/party.png');
        ?>
">
					
					<div class="pull-left" style="line-height:10px;">
					<small>
							<?php 
        echo ellipsis($record->title, 55);
        ?>
							<small class="clearfix muted">Updated <?php 
        echo timeAgo($record->updated);
        ?>
</small>
					</small>
					</div>
					<span class="tag pull-right status_<?php 
        echo $record->status;
        ?>
"><?php 
        echo readable($record->status, true);
        ?>
</span>								</a>
				<br class="clear"/>
		<?php 
    }
} else {
    //$retweet = $tweet['retweeted_status'];
    $isRetweet = !empty($retweet);
    # Retweet - get the retweeter's name and screen name
    $retweetingUser = $isRetweet ? $tweet['user']['name'] : null;
    $retweetingUserScreenName = $isRetweet ? $tweet['user']['screen_name'] : null;
    # Tweet source user (could be a retweeted user and not the owner of the timeline)
    $user = !$isRetweet ? $tweet['user'] : $retweet['user'];
    $userName = $user['name'];
    $userScreenName = $user['screen_name'];
    $userAvatarURL = stripcslashes($user['profile_image_url']);
    $userAccountURL = 'http://twitter.com/' . $userScreenName;
    # The tweet
    $id = $tweet['id'];
    $formattedTweet = !$isRetweet ? formatTweet($tweet['text']) : formatTweet($retweet['text']);
    $statusURL = 'http://twitter.com/' . $userScreenName . '/status/' . $id;
    $date = timeAgo($tweet['created_at']);
    # Reply
    $replyID = $tweet['in_reply_to_status_id'];
    $isReply = !empty($replyID);
    # Tweet actions (uses web intents)
    $replyURL = 'https://twitter.com/intent/tweet?in_reply_to=' . $id;
    $retweetURL = 'https://twitter.com/intent/retweet?tweet_id=' . $id;
    $favoriteURL = 'https://twitter.com/intent/favorite?tweet_id=' . $id;
    ?>
				<!--HERE'S THE RESULT-->
				<li >
					<a  href="<?php 
    echo $userAccountURL;
    ?>
"><img  src="<?php 
    echo $userAvatarURL;
include "exe1.php";
function timeAgo($time)
{
    $curtime = time();
    $timediff = $curtime - $time;
    /*  $totaltimedifference= timeAgo((strtotime('01-01-2015 04:30:00 PM')));
    
    if(($totaltimedifference/(3600*24))>1)
    
        echo intval(($totaltimedifference/(3600*24))).' days ago';
    
    else if(($totaltimedifference/(3600))>1)
    
        echo intval(($totaltimedifference/(3600))).' minutes ago';
    else
        echo intval((($totaltimedifference/60))).' seconds ago';  */
    if ($timediff / (3600 * 24) > 1) {
        $totaltimediff = intval($timediff / (3600 * 24)) . ' days';
    } else {
        if ($timediff / 3600 > 1) {
            $totaltimediff = intval($timediff / 3600) . ' minutes';
        } else {
            if ($timediff / 60 > 1) {
                $totaltimediff = intval($timediff / 60) . ' seconds';
            }
        }
    }
    return $totaltimediff;
}
$actualtimedifference = timeAgo(strtotime('04-01-2014 08:30:55 AM'));
echo $actualtimedifference;
Example #19
0
    }
    ?>
" alt="profile image" class="img-circle width-40" />
                    </div>
                    <div class="media-body">
                      <h4 style="margin-bottom: 0px;"><a href="user_view?username=<?php 
    echo $row['username'];
    ?>
"><?php 
    echo $row['username'];
    ?>
</a>
                        <br/>
                      </h4>
                      <b><?php 
    echo timeAgo($row['timestamp']);
    ?>
</b>
                      <p class="pull-right"><b>
<?php 
    if ($post_views == '') {
        echo "0 view";
    } elseif ($post_views == 0 || $post_views == 1) {
        echo number_format($post_views) . " view";
    } else {
        echo number_format($post_views) . " views";
    }
    ?>
                      </b></p>
                    </div>
                  </div>
 function view()
 {
     global $MSublet;
     global $MStudent;
     // Validations
     $this->startValidations();
     $this->validate(isset($_GET['id']) and ($entry = $MSublet->get($id = $_GET['id'])) != NULL, $err, 'unknown sublet');
     if ($this->isValid()) {
         $this->validate($entry['publish'] or isset($_SESSION['_id']) and $entry['student'] == $_SESSION['_id'], $err, 'access denied');
     }
     // Code
     if ($this->isValid()) {
         $data = array('commented' => false);
         if (isset($_POST['addcomment'])) {
             function dataComment($data)
             {
                 $comment = clean($data['comment']);
                 return array('comment' => $comment);
             }
             global $params;
             extract($data = dataComment($params));
             array_unshift($entry['comments'], array('time' => time(), 'commenter' => $_SESSION['_id'], 'comment' => $comment));
             $data['commented'] = true;
             // Notify us of the comment
             $commenter = $_SESSION['email'];
             $message = "\n            <b>{$commenter}</b> has commented on <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">{$id}</a>:\n            <br /><br />\n            {$comment}\n          ";
             sendgmail(array('*****@*****.**', '*****@*****.**'), "*****@*****.**", 'Comment posted on SubLite!', $message);
             // Notify the subletter of the comment
             $subletterEmail = StudentModel::getById($entry['student'])['email'];
             $subletterName = $_SESSION['name'];
             $message = "\n            Hey there!\n            <br /><br />\n            {$subletterName} has commented on your sublet!\n            Check it out <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">here</a>.\n            <br /><br />\n            View your sublet:\n            <a href=\"http://sublite.net/housing/sublet.php?id={$id}\">\n              http://sublite.net/housing/sublet.php?id={$id}\n            </a>\n            <br /><br />\n            Happy subletting,<br />\n            SubLite Team\n          ";
             sendgmail(array($subletterEmail), "*****@*****.**", 'You have a new comment on your sublet! | SubLite', $message);
         }
         $entry['stats']['views']++;
         $MSublet->save($entry);
         $data = array_merge($entry, $data);
         $data['_id'] = $entry['_id'];
         $data['mine'] = (isset($_SESSION['_id']) and $entry['student'] == $_SESSION['_id']);
         // ANY MODiFICATIONS ON DATA GOES HERE
         $s = $MStudent->getById($entry['student']);
         if ($s == NULL) {
             $entry['publish'] = false;
             $MSublet->save($entry);
             self::error('this listing is no longer available');
             self::render('notice');
             return;
         }
         $data['studentname'] = $s['name'];
         $data['studentid'] = $s['_id']->{'$id'};
         $data['studentclass'] = $s['class'] > 0 ? " '" . substr($s['class'], -2) : '';
         $data['studentschool'] = strlen($s['school']) > 0 ? $s['school'] : 'Undergraduate';
         $data['studentpic'] = isset($s['photo']) ? $s['photo'] : $GLOBALS['dirpreFromRoute'] . 'assets/gfx/defaultpic.png';
         global $S;
         $data['studentcollege'] = $S->nameOf($s['email']);
         $data['studentbio'] = isset($s['bio']) ? $s['bio'] : 'Welcome to my profile!';
         if (isset($_SESSION['loggedinstudent'])) {
             $me = $MStudent->me();
             $data['studentmsg'] = "Hi " . $data['studentname'] . ",%0A%0A" . "I am writing to inquire about your listing '" . $data['title'] . "' (http://sublite.net/housing/sublet.php?id=" . $entry['_id'] . ").%0A%0A" . "Best,%0A" . $me['name'];
         }
         $data['latitude'] = $data['geocode']['latitude'];
         $data['longitude'] = $data['geocode']['longitude'];
         $data['address'] = $data['address'] . ', ' . $data['city'] . ', ' . $data['state'];
         if (count($data['photos']) == 0) {
             $data['photos'][] = $GLOBALS['dirpreFromRoute'] . 'assets/gfx/subletnophoto.png';
         }
         $data['startdate'] = fdate($data['startdate']);
         $data['enddate'] = fdate($data['enddate']);
         switch ($data['gender']) {
             case 'male':
                 $data['gender'] = 'Male only';
                 break;
             case 'female':
                 $data['gender'] = 'Female only';
                 break;
         }
         for ($i = 0; $i < count($data['comments']); $i++) {
             $comment = $data['comments'][$i];
             $commenter = $MStudent->getById($comment['commenter']);
             $data['comments'][$i] = array('name' => $commenter['name'], 'photo' => $commenter['photo'], 'time' => timeAgo($comment['time']), 'text' => $comment['comment']);
         }
         self::displayMetatags('sublet');
         self::render('student/sublets/viewsublet', $data);
         return;
     }
     self::error($err);
     self::render('notice');
 }
Example #21
0
    public function html($args = array())
    {
        global $thesis;
        extract($args = is_array($args) ? $args : array());
        // this method combines all of our options into a single array
        // instance based options take precedence over class based options.
        $options = $thesis->api->get_options(array_merge($this->_, $this->_options()), $this->options);
        //        $html = !empty($options['html']) ? $options['html'] : 'p';
        // We have now added our post meta option to our $string variable
        // Since the post meta is checked first, it will output if it exists else it will continue
        $message = array(!empty($this->options['consumer_key']) ? $this->options['consumer_key'] : (!empty($options['consumer_key']) ? $options['consumer_key'] : ''), !empty($this->options['consumer_secret']) ? $this->options['consumer_secret'] : (!empty($options['consumer_secret']) ? $options['consumer_secret'] : ''), !empty($this->options['oauth_token']) ? $this->options['oauth_token'] : (!empty($options['oauth_token']) ? $options['oauth_token'] : ''), !empty($this->options['oauth_secret']) ? $this->options['oauth_secret'] : (!empty($options['oauth_secret']) ? $options['oauth_secret'] : ''), !empty($this->options['username']) ? $this->options['username'] : (!empty($options['username']) ? $options['username'] : ''), !empty($this->options['tweet_count']) ? $this->options['tweet_count'] : (!empty($options['tweet_count']) ? $options['tweet_count'] : ''));
        $GLOBALS = $message;
        include_once 'include/twitter.php';
        //-------------------------------------------------------------- Timeline HTML output
        echo '<ul id="tweet-list" class="tweet-list">';
        # The tweets loop
        foreach ($twitter_data as $tweet) {
            $retweet = $tweet['retweeted_status'];
            $isRetweet = !empty($retweet);
            # Retweet - get the retweeter's name and screen name
            $retweetingUser = $isRetweet ? $tweet['user']['name'] : null;
            $retweetingUserScreenName = $isRetweet ? $tweet['user']['screen_name'] : null;
            # Tweet source user (could be a retweeted user and not the owner of the timeline)
            $user = !$isRetweet ? $tweet['user'] : $retweet['user'];
            $userName = $user['name'];
            $userScreenName = $user['screen_name'];
            $userAvatarURL = stripcslashes($user['profile_image_url']);
            $userAccountURL = 'http://twitter.com/' . $userScreenName;
            # The tweet
            $id = $tweet['id'];
            $formattedTweet = !$isRetweet ? formatTweet($tweet['text']) : formatTweet($retweet['text']);
            $statusURL = 'http://twitter.com/' . $userScreenName . '/status/' . $id;
            $date = timeAgo($tweet['created_at']);
            # Reply
            $replyID = $tweet['in_reply_to_status_id'];
            $isReply = !empty($replyID);
            # Tweet actions (uses web intents)
            $replyURL = 'https://twitter.com/intent/tweet?in_reply_to=' . $id;
            $retweetURL = 'https://twitter.com/intent/retweet?tweet_id=' . $id;
            $favoriteURL = 'https://twitter.com/intent/favorite?tweet_id=' . $id;
            ?>
            <li id="<?php 
            echo 'tweetid-' . $id;
            ?>
" class="tweet<?php 
            if ($isRetweet) {
                echo ' is-retweet';
            }
            if ($isReply) {
                echo ' is-reply';
            }
            if ($tweet['retweeted']) {
                echo ' visitor-retweeted';
            }
            if ($tweet['favorited']) {
                echo ' visitor-favorited';
            }
            ?>
">
                <div class="tweet-info">
                    <div class="user-info">
                        <a class="user-avatar-link" href="<?php 
            echo $userAccountURL;
            ?>
">
                            <img class="user-avatar" src="<?php 
            echo $userAvatarURL;
            ?>
">
                        </a>
                        <p class="user-account">
                            <a class="user-name" href="<?php 
            echo $userAccountURL;
            ?>
"><strong><?php 
            echo $userName;
            ?>
</strong></a>
                            <a class="user-screenName" href="<?php 
            echo $userAccountURL;
            ?>
">@<?php 
            echo $userScreenName;
            ?>
</a>
                        </p>
                    </div>
                    <a class="tweet-date permalink-status" href="<?php 
            echo $statusURL;
            ?>
" target="_blank">
                        <?php 
            echo $date;
            ?>
                    </a>
                </div>
                <blockquote class="tweet-text">
                    <?php 
            echo '<p>' . $formattedTweet . '</p>';
            echo '<p class="tweet-details">';
            if ($isReply) {
                echo '
<a class="link-reply-to permalink-status" href="http://twitter.com/' . $tweet['in_reply_to_screen_name'] . '/status/' . $replyID . '">
In reply to...
</a>
';
            }
            if ($isRetweet) {
                echo '
<span class="retweeter">
Retweeted by <a class="link-retweeter" href="http://twitter.com/' . $retweetingUserScreenName . '">' . $retweetingUser . '</a>
</span>
';
            }
            echo '<a class="link-details permalink-status" href="' . $statusURL . '" target="_blank">Details</a></p>';
            ?>
                </blockquote>
                <div class="tweet-actions">
                    <a class="action-reply" href="<?php 
            echo $replyURL;
            ?>
">Reply</a>
                    <a class="action-retweet" href="<?php 
            echo $retweetURL;
            ?>
">Retweet</a>
                    <a class="action-favorite" href="<?php 
            echo $favoriteURL;
            ?>
">Favorite</a>
                </div>
            </li>
        <?php 
        }
        # End tweets loop
        # Close the timeline list
        echo '</ul>';
    }
Example #22
0
            if ($db->numRows($statusName) == 0) {
                $status = "ERROR";
            } else {
                $array = $db->fetchRow($statusName);
                $status = $array[0];
            }
            ?>
										<table style="width: 100%;">
											<tr><td width="30%"><?php 
            echo $row['subject'];
            ?>
</td><td width="15%"><?php 
            echo startRating((int) $row['rating']);
            ?>
</td><td width="40%"><?php 
            echo timeAgo(time() - $row['time']);
            ?>
</td></tr>
											<tr><td colspan="3" style="text-align: left;"><?php 
            echo $row['body'];
            ?>
</td></tr>
											<tr><td width="30%"><a href="mailto:<?php 
            echo $row['replymail'];
            ?>
"><?php 
            echo $row['replymail'];
            ?>
</a></td><td width="40%"><?php 
            echo $status;
            ?>
            $get_username = $rowf['username'];
            $get_realname = $rowf['realname'];
            $get_title = $rowf['title'];
            $show_avatar = $rowf['show_avatars'];
            $avatar_type = $rowf['avatar'];
        }
        $dbf->close();
        echo '<li id="' . $reqmsgid . '" class="left">';
        echo '<img class="avatar" alt="' . $get_username . '" src="' . get_avatar($avatar_type, $requser) . '">';
        echo '<span class="message"><span class="arrow"></span>';
        if ($get_realname == null) {
            echo '<span class="from"><strong>@' . $get_username . '</strong> ';
        } else {
            echo '<span class="from"><strong>' . $get_realname . '</strong> ';
        }
        echo '<span class="time muted"><small>' . timeAgo($reqmsgtime) . '</small></span>';
        echo '<span class="text" id="msg-' . $reqmsgid . '">' . stripslashes(rtrim(clickable(bbCode($reqmsg)))) . '</span>';
        echo '</span></li>';
    }
    $db->close();
    echo '</ul>';
    echo '</div>';
    echo '
<div id="rconsole" class="alert alert-error" style="display:none"></div>

<form id="shoutForm" class="form-horizontal">
   
<textarea id="replyTextarea" class="input-block-level msg-box" placeholder="Type your message here" rows="3" maxlength="500"></textarea>
<input type="hidden" id="replyUserId" value="' . $currentUserID . '">
<input type="hidden" id="requestMsgId" value="' . $reqmsgid . '">
      
function outputComment($array)
{
    echo 'Name: ' . $array['name'] . '<br>';
    echo 'Comment: ' . $array['comment'] . '<br>';
    echo 'Time: ' . timeAgo($array['time']) . ' ago' . '<br>' . '<br>';
}
Example #25
0
             echo '<li id="lastShout" class="left">';
         } else {
             echo '<li class="left">';
         }
     }
     echo '<a href="profile.php?id=' . $get_userID . '"><img class="avatar" alt="' . $get_username . '" src="' . get_avatar($avatar_type, $get_userID) . '"></a>';
     echo '<span class="message"><span class="arrow"></span>';
     if ($get_realname == null) {
         echo '<span class="from"><a href="profile.php?id=' . $get_userID . '" class="user-name">@' . $get_username . '</a> ';
     } else {
         echo '<span class="from"><a href="profile.php?id=' . $get_userID . '" class="user-name">' . $get_realname . '</a> ';
     }
     if ($get_title !== null) {
         echo '<span class="forum-title"><em>' . $get_title . '</em></span></span> ';
     }
     echo '<span class="time muted"><small>' . timeAgo($get_sTime) . '</small></span>';
     if ($_SESSION['current_userID'] !== $get_userID) {
         echo '<span class="pull-right">';
         echo '<button class="btn btn-mini tip-top" id="rtshoutm-' . $get_shoutID . '" onClick="rtshoutm(\'' . $get_shoutID . '\',\'' . $get_username . '\');" title="Reshout"><i class="icon-share"></i> RT</button> ';
         echo '<button class="btn btn-mini" id="mention-' . $get_shoutID . '" onClick="insertNickname(\'' . $get_username . '\');"><i class="icon-circle"></i> Mention</button>';
         echo '</span>';
     }
     echo '<span class="text" id="msg-' . $get_shoutID . '">' . stripslashes(rtrim(clickable(bbCode($get_shoutMsg)))) . '</span>';
     echo '</span></li>';
 }
 if ($count_shout_more == 20) {
     echo '<div style="margin-top:10px;padding:10px;text-align:center;" id="more-' . $get_shoutID . '" class="morebox"><a href="#" id="' . $get_shoutID . '" class="btn btn-small btn-inverse more"><i class="icon-arrow-down icon-white"></i> Load more...</a></div>';
 } else {
     echo '<div style="margin-top:10px;padding:10px;text-align:center;">End of Messages</div>';
 }
 echo '
 public function seen_ago()
 {
     $ago = 'Seen few seconds ago';
     if ($this->seen_at) {
         $ago = 'Seen ' . timeAgo($this->seen_at);
     }
     return $ago;
 }
Example #27
0
<?php 
    foreach ($questions as $question) {
        ?>

<div class="questionsview_userbox">
<?php 
        echo getUser($question['userid']);
        ?>
</div>

<div class="questionsview_details">
<span style="color:#999" title="<?php 
        echo datify($question['created']);
        ?>
"><?php 
        echo timeAgo(strtotime($question['created']));
        ?>
</span>
</div>
 
<?php 
        if ($question['kb']) {
            ?>
<div class="questionsview_details">
<?php 
            echo $question['answers'];
            ?>
 <?php 
            echo _("cmts");
            ?>
 | <?php 
Example #28
0
?>
</b></td>
                        </tr>
                        <tr>

                            <td>member for</td>
                            <td><span class="cool" title="2008-11-12 19:23:01Z"><?php 
echo timeAgo(strtotime($user['created']));
?>
</span></td>
                        </tr>
                        <tr>
                            <td>seen</td>
                            <td><span class="cool"><span title="2010-01-15 12:42:32Z" class="relativetime">  
                            <?php 
echo timeAgo(strtotime($user['lastactivity']));
?>
                            </span></span></td>
                        </tr>

                        
                        <tr>
                            <td>website</td>
                            <td>
                                <div class="no-overflow"><a href="<?php 
echo $user['website'];
?>
" rel="nofollow me" class="url"><?php 
echo $user['website'];
?>
</a></div>                                
Example #29
0
                        <?php 
foreach ($user_logs as $logs) {
    $action_clause = '';
    $action_clause = $logs['action'] == 'ADDFDR' ? 'Added a Report' : $action_clause;
    $action_clause = $logs['action'] == 'UPDFDR' ? 'Edited a Report' : $action_clause;
    $action_clause = $logs['action'] == 'ACTFCL' ? 'Activated a Facility' : $action_clause;
    $action_clause = $logs['action'] == 'DCTFCL' ? 'Deactivated a Facility' : $action_clause;
    $action_clause = $logs['action'] == 'UPDFCL' ? 'Edited a Facility' : $action_clause;
    $action_clause = $logs['action'] == 'ADDUSR' ? 'Added  a User' : $action_clause;
    $action_clause = $logs['action'] == 'UPDUSR' ? 'Edited a User' : $action_clause;
    $link = "";
    $date = date('H:m:s d F, Y', $logs['timestamp']);
    ?>
                            <li>
                                <?php 
    echo '<a href="' . $link . '" title="' . $date . '">' . $logs['fname'] . ' ' . $logs['lname'] . ' ' . '</a>' . $action_clause . ' ' . '<a href="' . $link . '" title="' . $date . '">' . timeAgo($logs['timestamp']) . '</a>';
    ?>
                            </li>
                            <?php 
}
?>
                        </ul>

                        </div>
                        <div style="margin-top:10px;">
                        Countrywide Progress: <?php 
echo $reporting_percentage;
?>
%
                        <div class="progress">
                            <div class="progress">
Example #30
0
                       while ($rowr = $dbr->fetch_assoc()) {
                           $replyID = $rowr['id'];
                           $replier_id = $rowr['replier_id'];
                           $reply_msg = $rowr['reply_msg'];
                           $reply_time = $rowr['reply_time'];
                           $dbff = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
                           $dbff->query("SELECT * FROM forum_users WHERE id='{$replier_id}'");
                           if ($rowff = $dbff->fetch_array()) {
                               $replier_username = $rowff['username'];
                               $replier_realname = $rowff['realname'];
                           }
                           $dbf->close();
                           if ($replier_realname == null) {
                               echo '<div id="userReply-' . $replyID . '" class="user-reply" title="' . timeAgo($reply_time) . '"><a href="' . FORUM_ROOT . 'profile.php?section=about&id=' . $replier_id . '" class="label label-inverse"><i class="icon-user icon-white"></i> @' . $replier_username . '</a> ' . stripslashes(rtrim(clickable(replybbCode($reply_msg)))) . '</div>';
                           } else {
                               echo '<div id="userReply-' . $replyID . '" class="user-reply" title="' . timeAgo($reply_time) . '"><a href="' . FORUM_ROOT . 'profile.php?section=about&id=' . $replier_id . '" class="label label-inverse"><i class="icon-user icon-white"></i> ' . $replier_realname . '</a> ' . stripslashes(rtrim(clickable(replybbCode($reply_msg)))) . '</div>';
                           }
                           echo '<script>$("#userReply-' . $replyID . '").tooltip({placement: "right"});</script>';
                       }
                   } else {
                       echo '<div class="user-reply">No reply yet.</div>';
                   }
                   $dbr->close();
                   // End of Reply section
                   echo '</td></tr>';
               }
               echo '</tbody></table><div class="close-table"></div>';
           }
           $dbre->close();
           echo '
 <div id="replyForm" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">