echo $user->username; ?> /small"/></div> <div class="data"> <div class="name"><?php echo strl($user->fullname, 17); ?> </div> <br/> <div class="reply"><?php echo $replied; ?> </div> <div class="time"><?php echo ossn_user_friendly_time($message->time); ?> </div> </div> </div> <?php } } ?> </div> </div> <div class="message-with"> <script>
<a class="owner-link" href="<?php echo ossn_site_url("group/{$group->guid}"); ?> "> <?php echo $group->title; ?> </a> <?php } ?> <br/> <div class="time"> <?php echo ossn_user_friendly_time($params['post']->time_created); ?> <?php echo $params['location']; ?> - <div class="ossn-inline-table ossn-icon-access-<?php echo ossn_access_id_str($params['post']->access); ?> " title="<?php echo ossn_print('title:access:private:group'); ?> "></div>
if ($comment->type == 'comments:entity') { echo ' ' . $comment->getParam('comments:entity'); } elseif ($comment->type == 'comments:post') { echo ' ' . $comment->getParam('comments:post'); } $image = $comment->getParam('file:comment:photo'); if (!empty($image)) { $image = str_replace('comment/photo/', '', $image); $image = ossn_site_url("comment/image/{$comment->id}/{$image}"); echo "<img src='{$image}' />"; } ?> </p> <div class="comment-metadata"> <?php echo ossn_user_friendly_time($comment->time_created); ?> <?php if (ossn_isLoggedIn()) { if (!$OssnLikes->isLiked($comment->id, ossn_loggedin_user()->guid, $type)) { echo ossn_plugin_view('output/url', array('href' => ossn_site_url("action/annotation/like?annotation={$comment->id}"), 'text' => ossn_print('like'), 'class' => 'ossn-like-comment', 'data-type' => 'Like', 'action' => true)); } else { echo ossn_plugin_view('output/url', array('href' => ossn_site_url("action/annotation/unlike?annotation={$comment->id}"), 'text' => ossn_print('unlike'), 'class' => 'ossn-like-comment', 'data-type' => 'Unlike', 'action' => true)); } } // Likes only for loggedin users end // Show total likes echo ossn_plugin_view('output/url', array('href' => 'javascript::;', 'text' => $likes_total, 'class' => "ossn-total-likes-{$comment->id}", 'data-likes' => $datalikes)); ?> </div> </div>
/** * Convert time to to user recognize from * * @param $tm => time stamp * * @return bool */ function ossn_user_friendly_time($tm, $rcs = 0) { $cur_tm = time(); $dif = $cur_tm - $tm; // get language dependend items for display $passedtime = ossn_print('site:timepassed:data'); // put them into array // 0 = second // 15 = decades $pds = explode('|', $passedtime); // BETTER DO explode ONLY ONCE on start and when language changes // and get already prepared array from there // don't know how and where to do this correctly ?!? $lngh = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600); for ($v = count($lngh) - 1; $v >= 0 && ($no = $dif / $lngh[$v]) <= 1; $v--) { } if ($v < 0) { $v = 0; } $_tm = $cur_tm - $dif % $lngh[$v]; $no = $rcs ? floor($no) : round($no); // if last denomination, round // since our array now has 16 time elements instead of 8, we need to skip odd entries and fetch the next even one (the singular) $v = $v * 2; if ($no != 1) { // $pds[$v] .= 's'; // in case of plural we need the current element's index + 1 $v++; } $x = $no . ' ' . $pds[$v]; if ($rcs > 0 && $v >= 1) { $x .= ' ' . ossn_user_friendly_time($_tm, $rcs - 1); } return ossn_print('site:timepassed:text', $x); }
</td> <td><?php echo ossn_print('edit'); ?> </td> <td><?php echo ossn_print('delete'); ?> </td> </tr> <?php foreach ($pagination->getItem() as $user) { $user = ossn_user_by_guid($user->guid); $lastlogin = ''; if (!empty($user->last_login)) { $lastlogin = ossn_user_friendly_time($user->last_login); } ?> <tr> <td> <div class="image"><img src="<?php echo ossn_site_url(); ?> avatar/<?php echo $user->username; ?> /smaller"/></div> <div class="name" style="margin-left:39px;margin-top: -39px;min-height: 30px;"><?php echo strl($user->fullname, 20);
/** * Convert time to to user recognize from * * @param $tm => time stamp * * @return bool */ function ossn_user_friendly_time($tm, $rcs = 0) { $cur_tm = time(); $dif = $cur_tm - $tm; $pds = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade'); $lngh = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600); for ($v = count($lngh) - 1; $v >= 0 && ($no = $dif / $lngh[$v]) <= 1; $v--) { } if ($v < 0) { $v = 0; } $_tm = $cur_tm - $dif % $lngh[$v]; $no = $rcs ? floor($no) : round($no); // if last denomination, round if ($no != 1) { $pds[$v] .= 's'; } $x = $no . ' ' . $pds[$v]; if ($rcs > 0 && $v >= 1) { $x .= ' ' . ossn_user_friendly_time($_tm, $rcs - 1); } return $x . ' ago'; }