public function foot() { echo ' </div> </div> <div id="side"> <h3>Latest Pastes</h3> <ul id="latest_list"> '; $get_latest = $this->_sql->query("select `code`, `language`, `date` from `pastes` where `private` = '0' and `password` = '' order by `id` desc limit 10"); while ($paste = $this->_sql->fetch_assoc($get_latest)) { echo '<li><a href="' . WEB_PATH . 'p/' . $paste['code'] . '">' . $this->types[$paste['language']] . '</a><span>' . seconds_convert(time() - $paste['date']) . ' ago</span></li>'; } $this->_sql->free($get_latest); echo ' </ul> </div> </div> <div id="foot"> <a href="https://github.com/jrgp/pastebin/">GitHub</a> <br /><span style="color : #aaaaaa">PasteBin © 2011 PuttyNuts Web Services</span> </div> </div> ' . ($this->autoSelect ? ' <script type="text/javascript"> document.getElementById(\'' . addslashes($this->autoSelect) . '\').focus(); </script>' : '') . ' </body> </html> '; ob_end_flush(); }
private function getUpTime() { // Time? if (!empty($this->settings['timer'])) { $t = new LinfoTimerStart('Uptime'); } // Use sysctl $booted = strtotime($this->sysctl['kern.boottime']); // Give it return seconds_convert(time() - $booted) . '; booted ' . date('m/d/y h:i A', $booted); }
private function getUpTime() { // Time? if (!empty($this->settings['timer'])) { $t = new LinfoTimerStart('Uptime'); } // Get contents $contents = getContents('/proc/uptime', false); // eh? if ($contents === false) { $this->error->add('Linfo Core', '/proc/uptime does not exist.'); return 'Unknown'; } // Seconds list($seconds) = explode(' ', $contents, 1); // Get it textual, as in days/minutes/hours/etc $uptime = seconds_convert(ceil($seconds)); // Now find out when the system was booted $contents = getContents('/proc/stat', false); // Ugh if ($contents === false) { return $uptime; } // Settle for just uptime // Get date of boot if (preg_match('/^btime (\\d+)$/m', $contents, $boot) != 1) { return $uptime; } // Okay? list(, $boot) = $boot; // Return return $uptime . '; booted ' . date($this->settings['dates'], $boot); }
function generate_media_item($id, $title, $extension, $source, $height, $width, $file_size, $uploaded, $user, $caption, $search = false, $tags = '', $modal = false) { global $cms_all_users; global $cms_user; $click_type = $modal ? 'checkable' : 'editable'; ?> <tr class="media_item" id="media_<?php echo $id; ?> "> <td class="check" raw="X"><?php if ($cms_user['media'] || $modal) { ?> <input class="status_action_check" type="checkbox" name="media_ids_checked[]" value="<?php echo $id; ?> " id="<?php echo $id; ?> "><?php } ?> </td> <td class="thumb <?php echo $click_type; ?> " raw="X"> <?php if (!$modal) { ?> <input name="media_ids[]" type="hidden" value="<?php echo $id; ?> " /> <?php } generate_media_image($extension, $source, $height, $width, $file_size); $extension = strtoupper($extension); $file_size_text = $extension == 'YOUTUBE' || $extension == 'VIMEO' ? seconds_convert($file_size) : byte_convert($file_size); ?> </td> <td class="field_title first_field <?php echo $click_type; ?> "><div class="wrap"><?php echo $title; ?> </div></td> <td class="field_type <?php echo $click_type; ?> "><div class="wrap"><?php echo $extension; ?> </div></td> <td class="field_size <?php echo $click_type; ?> "><div class="wrap"><?php echo $file_size_text; ?> </div></td> <td class="field_caption <?php echo $click_type; ?> "><div class="wrap" title="<?php echo $tags; ?> "><?php echo $caption; ?> <span class="hide"><?php echo $tags; ?> </span></div></td> <td class="field_user <?php echo $click_type; ?> "><div class="wrap"><?php echo $user == $cms_user['id'] ? '<strong>' . $cms_all_users[$user]['username'] . '</strong>' : $cms_all_users[$user]['username']; ?> </div></td> <td class="field_date <?php echo $click_type; ?> "><div class="wrap" title="<?php echo date('Y-m-d H:i:s', strtotime($uploaded)); ?> "><?php echo contextual_time(strtotime($uploaded)); ?> </div></td> </tr> <?php }
public function getUpTime() { // Time? if (!empty($this->settings['timer'])) { $t = new LinfoTimerStart('Uptime'); } // Extract boot part of it if (preg_match('/^\\{ sec \\= (\\d+).+$/', $this->sysctl['kern.boottime'], $m) == 0) { return ''; } // Get it textual, as in days/minutes/hours/etc return seconds_convert(time() - $m[1]) . '; booted ' . date($this->settings['dates'], $m[1]); }
</ul> </div> <?php } ?> <div class="fieldset" id="media_modal_area_add"> <?php if (is_numeric($_GET['id'])) { ?> <div class="field" > <?php ////////////////////////////////////////////////////////////////////////////// // Get media details if ($extension == 'youtube' || $extension == 'vimeo') { $length_size = seconds_convert($media_detail['file_size']); if ($extension == 'youtube') { $link = 'http://www.youtube.com/watch?v=' . $media_detail["source"]; $link_text = 'http://www.youtube.com/watch?v=<b>' . $media_detail["source"] . '</b>'; } elseif ($extension == 'vimeo') { $link = 'http://vimeo.com/' . $media_detail["source"]; $link_text = 'http://vimeo.com/<b>' . $media_detail["source"] . '</b>'; } $dimensions = $media_detail['width'] . ' x ' . $media_detail['height'] . ' - '; } else { if ($extension == 'jpg' || $extension == 'gif' || $extension == 'png') { $length_size = byte_convert($media_detail['file_size']); $link = '../' . $settings['cms']['media_path'] . $media_detail["source"]; $dimensions = $media_detail['width'] . ' x ' . $media_detail['height'] . ' - '; } else { $length_size = byte_convert($media_detail['file_size']);
private function getUpTime() { $booted = $this->kstat['unix:0:system_misc:boot_time']; return seconds_convert(time() - $booted) . '; booted ' . date($this->settings['dates'], $booted); }
private function getUpTime() { // Time? if (!empty($this->settings['timer'])) { $t = new LinfoTimerStart('Uptime'); } // Use sysctl to get unix timestamp of boot. Very elegant! if (preg_match('/^\\{ sec \\= (\\d+).+$/', $this->sysctl['kern.boottime'], $m) == 0) { return ''; } // Boot unix timestamp $booted = $m[1]; // Get it textual, as in days/minutes/hours/etc return seconds_convert(time() - $booted) . '; booted ' . date($this->settings['dates'], $booted); }
private function getUpTime() { $booted = $this->kstat['unix:0:system_misc:boot_time']; return seconds_convert(time() - $booted) . '; booted ' . date('m/d/y h:i A', $booted); }
/** * getUpTime * * @access private * @return string uptime */ private function getUpTime() { // Time? if (!empty($this->settings['timer'])) { $t = new LinfoTimerStart('Uptime'); } $booted_str = ""; foreach ($this->wmi->ExecQuery("SELECT LastBootUpTime FROM Win32_OperatingSystem") as $os) { $booted_str = $os->LastBootUpTime; break; } $booted = array('year' => substr($booted_str, 0, 4), 'month' => substr($booted_str, 4, 2), 'day' => substr($booted_str, 6, 2), 'hour' => substr($booted_str, 8, 2), 'minute' => substr($booted_str, 10, 2), 'second' => substr($booted_str, 12, 2)); $booted_ts = mktime($booted['hour'], $booted['minute'], $booted['second'], $booted['month'], $booted['day'], $booted['year']); return seconds_convert(time() - $booted_ts) . '; booted ' . date($this->settings['dates'], $booted_ts); }
function date_difference($date1, $return = '', $date2 = false, $pos = true) { $date1 = string_time($date1); $date2 = empty($date2) ? time() : string_time($date2); if (empty($date1) or empty($date2)) { return false; } $diff = $date2 - $date1; $diff = ($diff < 0 and $pos) ? $diff * -1 : $diff; return !empty($return) ? seconds_convert($diff, $return) : $diff; }
private function getUpTime() { // Time? if (!empty($this->settings['timer'])) { $t = new LinfoTimerStart('Uptime'); } // Short and sweet $booted = $this->sysctl['kern.boottime']; // Well f**k? if ($booted == false) { return 'Unknown'; } // Is it not a timestamp? if (!is_numeric($booted)) { $booted = strtotime($booted); } // Give it return seconds_convert(time() - $booted) . '; booted ' . date($this->settings['dates'], $booted); }
function testSecondsNotYears() { $seconds = 60 * 60 * 24 * 364; $convert = seconds_convert($seconds, 'year'); $this->assertEquals(0, $convert); }
private function getUpTime() { // Time? if (!empty($this->settings['timer'])) { $t = new LinfoTimerStart('Uptime'); } // Short and sweet $booted = $this->getSysCTL('kern.boottime'); // Well f**k? if ($booted == false) { return 'Unknown'; } // Give it return seconds_convert(time() - $booted) . '; booted ' . date('m/d/y h:i A', $booted); }