<?php if ($alert_level == "critical") { echo '<p class="alert alert-danger"><a href="/alert/ackuser/' . $alert_id . '?return_url=' . urlencode($_SERVER["REQUEST_URI"]) . '" title="Remove" class="pull-right btn btn-sm btn-danger">Remove</a><strong>Critical Alert!</strong> Server: ' . $hostname . ', Module: ' . $alert_module . ', Value: ' . $alert_value . ', ' . elapsed_time(time() - $alert_time) . ' ago</p>'; } else { if ($alert_level == "warning") { echo '<p class="alert alert-warning"><a href="/alert/ackuser/' . $alert_id . '?return_url=' . urlencode($_SERVER["REQUEST_URI"]) . '" title="Remove" class="pull-right btn btn-sm btn-warning">Remove</a><strong>Warning!</strong> Server: ' . $hostname . ', Module: ' . $alert_module . ', Value: ' . $alert_value . ', ' . elapsed_time(time() - $alert_time) . ' ago</p>'; } }
function save_txt() { global $curr_txt, $txt_num, $source_index, $source_length; $curr_txt = preg_replace('/\\s+/', ' ', $curr_txt); $curr_txt = trim($curr_txt); $time = elapsed_time(); $percent = round(100 * $source_index / $source_length) . '%'; if (!empty($curr_txt)) { echo "{$txt_num}.txt ({$time} {$percent})\n----------------------------\n{$curr_txt}\n\n"; flush(); if (!file_exists('txt')) { mkdir('txt'); } file_put_contents("txt/{$txt_num}.txt", $curr_txt); $txt_num++; $curr_txt = ''; } }
<td style="width: 50px;" class="text-center"><?php echo $_status_icon != '' ? '<a title="' . ucfirst($task['controller']) . '" href="javascript:void(0);"><i class=" ' . $_status_icon . '"></i></a>' : $task['controller']; ?> </td> <td style="width: 50px;" class="text-center"><a href="javascript:void(0);" title="<?php echo ucfirst($task['status']); ?> "><i class="<?php echo $_status; ?> "></i></a></td> <td><b><?php echo ucfirst($task['type']); ?> </b> - <i class="fa fa-clock-o"></i> <?php echo elapsed_time($task['status'] == 'running' ? $task['start_date'] : $task['finish_date']); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <?php } else {
<ul> <?php foreach ($posts as $post) { ?> <li id="post_<?php echo $post->id; ?> " class="file user_<?php echo $post->user_id; ?> " data-colors="<?php echo get_colors($post->user_id); ?> "> <span class="meta"><?php echo elapsed_time($post->created); ?> </span><br> <a href="<?php echo "p/{$post->id}"; ?> " class="filename"><?php echo $post->content; ?> </a> <a href="<?php echo "p/{$post->id}/edit"; ?> " class="edit"><?php echo _('Edit'); ?>
</div> <div class="col-xs-12 col-sm-6"> <div class="panel panel-default"> <div class="panel-heading">Latest Logs <span class="pull-right"><a class="btn btn-info btn-xs" href="/node/logs/<?php echo $node->id; ?> ">View All</a></span></div> <div class="panel-scroll"> <table id="logs-header" class="table table-condensed table-striped"> <thead> <tr><th>Time</th><th>CT</th><th>Type</th><th>Message</th></tr> </thead> <tbody> <?php foreach ($logs as $log) { echo '<tr><td>' . elapsed_time(time() - $log->log_time, true) . ' ago</td><td><a href="/server/' . $log->log_container . '">' . $log->log_container . '</a></td><td>' . $log->log_level . '</td><td>' . $log->log_message . '</td></tr>'; } ?> </tbody> </table> </div> </div> </div><!-- End first column --> <!-- Start second column --> <div class="col-md-12 col-xl-6"> <div class="panel panel-default"> <div class="panel-heading">Processes</div> <div class="panel-body no-pad"> <table id="processes" class="table table-condensed tablesorter"> <thead>
echo "{$url}#reply\">" . _('post a reply'); } else { echo "{$url}\">" . sprintf(ngettext('%d reply', '%d replies', $post->reply_count), $post->reply_count); } ?> </a> <?php if (!empty($_SESSION['is_admin'])) { ?> <a href="#" class="delete" data-id="<?php echo $post->id; ?> "><?php echo _('delete'); ?> </a> <?php } ?> </div> <div class="when"> <?php echo "<a href=\"{$url}\" class=\"permalink\">" . elapsed_time($post->created) . "</a>"; if ($this->view == 'user.php' && $post->parent_id != '0') { echo " / <a href=\"p/{$post->parent_id}\">" . _('In reply to') . '</a>'; } ?> </div> <div class="clear"></div> </article>
echo $node->disk_total; ?> " style="width: <?php echo max($node->disk_used / $node->disk_total * 100, 1); ?> %"></div> </div> </td> <td class="hidden-xs">In: <?php echo byte_format($node->bytes_in / 5); ?> /s<br />Out: <?php echo byte_format($node->bytes_out / 5); ?> /s </td> <td class="hidden-xs"><?php echo elapsed_time($node->uptime); ?> </td> </tr> <?php } ?> </table> </div> </div> <?php } ?> </div>
function set_elapsed_time(&$shift) { $shift->created = ucfirst(elapsed_time($shift->created)); }
} else { if (!empty($_SERVER['HTTP_REFERER'])) { $href = $db->escape($_SERVER['HTTP_REFERER']); } } // grab the real shift id $qry = "\n SELECT s.space, s.summary, s.href, u.username, u.email, s.id\n FROM shift s, user u\n WHERE s.url_slug='{$shiftId}'\n AND s.user_id = u.id\n"; $shift = $db->row($qry); // grab all comments for this shift $qry = "\n SELECT c.content, u.username, u.email, c.created, c.modified\n FROM comment c, user u\n WHERE u.id = c.user_id\n AND c.shift_id = {$shift->id}\n ORDER BY c.created ASC\n"; $comments = $db->rows($qry); $allComments = ''; for ($i = 0; $i < count($comments); $i++) { $currentComment = $comments[$i]; $num = $i + 1; $date = ucfirst(elapsed_time($currentComment->created)); $commentGravatar = md5($currentComment->email); $newComment = "\t\n <li id='com-2' class='comment original'>\n \t\t<div class='com-meta'>\n \t\t\t<div class='com-meta-text'>\n \t\t\t\t<span class='com-num'>{$num}. </span><a target='new' class='com-author' title='Browse {$currentComment->username}’s shifts on the ShiftSpace Public Square' href='http://www.shiftspace.org/shifts/?filter=by&filterBy={$currentComment->username}'>{$currentComment->username}</a> said <span class='time-ago'>({$date})</span>:\n \t\t\t</div>\n \t\t\t<a href='' class='com-author'>\n \t\t\t\t<img src='http://www.gravatar.com/avatar.php?gravatar_id={$commentGravatar}&size=33.jpg'/>\n \t\t\t</a>\n \t\t</div>\n \t\t<div class='com-content'>\n \t\t\t{$currentComment->content}\n \t\t</div>\n \t</li>"; // append the markup of the new comment $allComments .= $newComment; } if ($user) { $replyButton = "<a class='com-reply' href='#' title='Reply to this thread'>Reply</a>"; $commentForm = "<div id='respond'>\n \t<h3>Hey {$user->username}, post a comment!</h3>\n \t<textarea tabindex='6' rows='8' cols='35' name='comment' id='comment-reply'></textarea>\n \t<input type='submit' tabindex='7' value='Post Comment' class='button' name='submit' id='submit'/>\n </div>"; } else { $replyButton = ""; $commentForm = "<div id='respond'><h3>You must be signed in to leave a comment.</h3></div>"; } $ownerGravatar = md5($shift->email); $spaceIcon = "http://www.shiftspace.org/dev/images/" . strtolower($shift->space) . "_thumb.png"; $shiftHref = $shift->href;
} else { $shift_ids[] = $id; } // for single shifts on the proxy $cshift; $spaceName; $userName; $shifthref; // Load each requested shift foreach ($shift_ids as $an_id) { // grab the shift $shift = $db->row("\n SELECT *\n FROM shift\n WHERE url_slug = '{$an_id}'\n "); $cshift = $shift; $spaceName = $shift->space; $shifthref = $shift->href; $date = ucfirst(elapsed_time($shift->created)); // grab the user name $user_id = $shift->user_id; $userName = $db->value("\n SELECT username\n FROM user\n where id={$user_id}\n "); $legacy = true; if ($spaceName == 'notes') { $spaceName = 'Notes'; } else { if ($spaceName == 'highlight') { $spaceName = 'Highlights'; } else { if ($spaceName == 'imageswap') { $spaceName = 'ImageSwap'; } else { if ($spaceName == 'sourceshift') { $spaceName = 'SourceShift';
if ($session->level != 'admin' && $session->level != 'reader') { $html->do_sysmsg('Forbidden', null, 403); } if (isset($params[1]) && ctype_digit($params[1]) && $params[1] > 0) { $page_number = $params[1]; } elseif (!isset($params[1])) { $page_number = 1; } else { $html->do_sysmsg(_('Page not found'), null, 404); } $page_size = $settings->page_size * 2; $rows = $db->get_var('SELECT COUNT(1) from topics WHERE db = :db', array(array(':db', $settings->db, PDO::PARAM_STR))); $query = sprintf('SELECT * FROM topics WHERE db = :db ORDER BY id DESC LIMIT %d,%d', ($page_number - 1) * $page_size, $page_size); $topics = $db->get_results($query, array(array(':db', $settings->db, PDO::PARAM_STR))); if (!$topics) { $html->do_sysmsg(_('Page not found'), null, 404); } $html->do_header(); $mod = sprintf('%stopics/%%d', $settings->base_url, 'page'); $pager = $html->do_pages($page_number, ceil($rows / $page_size), $mod, 4); $odd = true; foreach ($topics as $topic) { $odd = !$odd; $topic['style'] = $odd ? 'odd' : 'even'; $topic['date'] = date('d/m/Y H:i:s', $topic['timestamp']); $topic['timelapse'] = elapsed_time(date('U') - $topic['timestamp']); $vars = compact('topic'); $html->output .= Haanga::Load('topic.html', $vars, true); } $html->output .= $pager; $html->do_footer();
<?php $title = "Accueil"; include "setup.php"; if (isset($_REQUEST['loggedok'])) { $feedback[] = array('num' => 1, 'msg' => tra("Vous êtes maintenant identifié")); } // sur le proto, on n'affiche la carte que si on est loggéavec un profil >=1 et que le code profil $bool_map_disp = !empty($_SESSION['me']) && $_SESSION['profile'] >= 1 || $anonym_disp_maps; $bool_pya_link = !empty($_SESSION['me']) && $_SESSION['profile'] == 1; $smarty->assign('bool_pya_link', $bool_pya_link); $smarty->assign('bool_map_disp', $bool_map_disp); $smarty->display("home.tpl"); echo elapsed_time();
</div> <div class="text-only hidden"> <?php echo htmlentities($post->content, ENT_COMPAT, 'UTF-8'); ?> </div> <div class="content"> <?php echo nl2br(htmlentities($post->content)); ?> </div> </div> <div class="meta"> <?php echo '<span class="elapsedtime">' . elapsed_time($post->created) . '</span>'; if ($this->view == 'user.php' && $post->parent_id != '0') { echo " / <a href=\"p/{$post->parent_id}\">" . _('In reply to') . '</a>'; } ?> <a class="replies-link" href="<?php $url = "p/{$post->id}"; if ($post->reply_count == 0) { echo "{$url}#reply\">" . _('post a reply'); } else { echo "{$url}\">" . sprintf(ngettext('%d reply', '%d replies', $post->reply_count), $post->reply_count); } ?> </a> <?php if (!empty($_SESSION['is_admin'])) {
<a class="pull-right" href="/alert/ack/all">Clear All</a></div> <table id="node-alerts-body" class="table table-condensed table-striped"> <thead> <tr> <th>Server</th><th>Time</th><th>Module</th><th>Value</th><th></th> </tr> </thead> <tbody class="panel-scroll"> <?php if (count($node_alerts) != 0) { foreach ($node_alerts as $alert) { echo ' <tr> <td><a href="/node/' . $alert->alert_server . '">' . $alert->node_name . '</a></td> <td>' . elapsed_time(time() - $alert->alert_time) . ' ago</td> <td>' . $alert->alert_module . '</td> <td>' . $alert->alert_value . '</td> <td><a class="btn btn-danger btn-xs remove-btn" href="/alert/ack/' . $alert->alert_id . '"><i class="fa fa-times"></i></a></td> </tr>'; } } else { echo ' <tr><td colspan="5" class="text-center">Nothing to report here.</td></tr>'; } ?> </tbody> </table> </div> </div> <?php
"> <a href="<?php echo "p/{$file->message_id}"; ?> " class="filename"><?php echo $file->name; ?> </a> <div class="meta"> <span class="author"><a href="u/<?php echo $file->user_id; ?> " class="id"><span class="color"></span><?php echo get_username($file->user_id); ?> </a></span> <span class="when"><?php echo elapsed_time($file->created); ?> </span> </div> </li> <?php } ?> </ul> <?php } ?> </div>
<?php if ($alert_level == "critical") { echo '<p class="msg-error"><strong>Critical Alert!</strong> Module: ' . $alert_module . ', Value: ' . $alert_value . ', ' . elapsed_time(time() - $alert_time) . ' ago <a href="/alert/ack/' . $alert_id . '" title="Remove" class="remove-btn">Remove</a></p>'; } else { if ($alert_level == "warning") { echo '<p class="msg-attention"><strong>Warning!</strong> Module: ' . $alert_module . ', Value: ' . $alert_value . ', ' . elapsed_time(time() - $alert_time) . ' ago <a href="/alert/ack/' . $alert_id . '" title="Remove" class="remove-btn">Remove</a></p>'; } }
#!/usr/bin/env php <?php /** * @file bcrypt_hint.php * * simple script to compute the "optimal" bcrypt cost that should be used on * this host. */ require_once dirname(__FILE__) . '/../../vendor/autoload.php'; define('MIN_SEC', 0.2); define('MAX_SEC', 0.5); function elapsed_time($func) { $start = microtime(true); $func(); return microtime(true) - $start; } $results = []; $t = 0; $cost = 4; while ($t < MAX_SEC) { $t = elapsed_time(function () use($cost) { password_hash('secret', PASSWORD_BCRYPT, ['cost' => $cost]); }); $results[] = ['cost' => $cost, 'time' => $t]; $cost++; } foreach ($results as $r) { $is_cool = $r['time'] > MIN_SEC && $r['time'] < MAX_SEC; printf("cost %d: %.3fs%s\n", $r['cost'], $r['time'], $is_cool ? ' <--- cool' : ''); }
//$tabLD=array(0=>"Aucun")+$tabLD; $DispMsg=false; // n'affiche pas la mention en bas de la liste d?roulante */ //$smarty->assign('LD_filt_pts_LEI',DispLD($tabLD,"rq_lei_f_idcat","yes","",false)); // nbre max de traces affich?es dans la liste $maxdisptracks = $_SESSION['admin'] ? 100 : 20; $smarty->assign('maxdisptracks', $maxdisptracks); $smarty->assign('sizex', $sizex); $smarty->assign('pid', $_SESSION['pid']); $smarty->assign('sizey', $sizey); $smarty->assign('sizecheck', $sizecheck); $smarty->assign('mapmargin', $mapmargin); $smarty->assign('blockspc', $blockspc); $scale = $e_map->scale; $smarty->assign('scale', floor($scale)); $smarty->assign('refsrc', $refsrc); $smarty->assign('refwidth', $refwidth); $smarty->assign('refheight', $refheight); $smarty->assign('focus', $focus); if (isset($map_click)) { $smarty->assign('map_click', $map_click); } $smarty->assign('mapimage', $image); $smarty->assign('discps', $discps); $smarty->assign('discpcolor', $discpcolor); //$smarty->assign('icontypes',$icontypes); $smarty->assign('times', $times); $smarty->assign('levels', $levels); $smarty->display("map.tpl"); echo "<div style='font-size:9px;padding:3px;'>" . tra('Temps') . ' : ' . elapsed_time() . " s</div>";
} ?> </table> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-default"> <div class="panel-heading">Latest HostGuard News</div> <div class="panel-body no-pad panel-scroll"> <table class="table table-condensed"> <?php foreach ($news as $n) { echo '<tr><td> <a href="' . $n->url . '" target="_blank">' . $n->name . '</a></td><td>' . elapsed_time(time() - date_timestamp_get(new DateTime($n->date)), true) . ' ago </td></tr>'; } ?> </table> </div> </div> </div> <div class="row"> <div class="col-md-12"> <?php $this->load->view('node/admin-home'); ?> </div> </div>
function generate() { global $settings; $this->new = date('U') - $this->timestamp < 60 * 60 * 24; $this->permalink = sprintf('%s%s', $settings->full_url, $this->permaid); $date = elapsed_time(date('U') - $this->timestamp); $this->timelapse = $date == -1 ? false : $date; $this->hidden = (bool) $this->hidden; $this->excerpt = $this->text_clean($this->text, 'excerpt'); $this->password = substr(md5(sprintf('a%sb%sc%sd', $settings->site_key, $this->permaid, date('d/m:H'))), 0, 8); $this->date = date('d/m/Y H:i:s', $this->timestamp); $this->permaid = (string) $this->permaid; }
public function handle_shutdown() { dlog('[' . elapsed_time() . '] application::shutdown', 'debug'); }