function formatLoggedSpan($log_item, $text, $html_class = '') { $title = ''; if (!empty($log_item)) { $html_class = trim($html_class . ' hover-history'); $title = htmlspecialchars($log_item['user'] . ', ' . formatAge($log_item['time']), ENT_QUOTES); } return "<span" . (strlen($html_class) ? " class='{$html_class}'" : '') . (strlen($title) ? " title='{$title}'" : '') . ">{$text}</span>"; }
function filelist($phpvars, $page) { global $FilesPerPage, $TimeZoneCorrection; $cnt = count($phpvars['files']); $pagecount = pagecount($cnt, $FilesPerPage); if ($page > $pagecount) { $page = $pagecount; } if ($page < 1) { $page = 1; } echo '<div class = "block"><center>Files for downloading</center><br>'; echo '<table width="100%">'; echo '<tr><td colspan="7"></td><td>name</td><td width="50" align="right">age</td><td width="60" align="right">total</td></tr>'; foreach (array_slice($phpvars['files'], ($page - 1) * $FilesPerPage, $FilesPerPage) as $cur_queued) { $paused = $cur_queued['Paused']; if ($paused) { echo '<tr class="pausedgroup">'; } else { echo '<tr class="unpausedgroup">'; } echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=filedelete&offset=0&id=' . $cur_queued['ID'] . '\')"><IMG src=images/cancel.gif width=15 height=15 alt="remove file" title="remove file"></a></td>'; echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=filemovetop&offset=0&id=' . $cur_queued['ID'] . '\')"><IMG src=images/first.gif width=15 height=15 alt="move file to top in queue" title="move file to top in queue"></a></td>'; echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=filemoveoffset&offset=-1&id=' . $cur_queued['ID'] . '\')"><IMG src=images/up.gif width=15 height=15 alt="move file up" title="move file up"></a></td>'; echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=filemoveoffset&offset=1&id=' . $cur_queued['ID'] . '\')"><IMG src=images/down.gif width=15 height=15 alt="move file down" title="move file down"></a></td>'; echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=filemovebottom&offset=0&id=' . $cur_queued['ID'] . '\')"><IMG src=images/last.gif width=15 height=15 alt="move file to bottom in queue" title="move file to bottom in queue"></a></td>'; echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=filepause&offset=0&id=' . $cur_queued['ID'] . '\')"><IMG src=images/pause.gif width=15 height=15 alt="pause file" title="pause file"></a></td>'; echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=fileresume&offset=0&id=' . $cur_queued['ID'] . '\')"><IMG src=images/resume.gif width=15 height=15 alt="resume file" title="resume file"></a></td>'; echo "<td>" . namereplace($cur_queued['NZBNicename']) . "/" . namereplace($cur_queued['Filename']) . "</td>"; echo '<td align="right">' . formatAge($cur_queued['PostTime'] + $TimeZoneCorrection * 60 * 60) . '</td>'; echo "<td align=right>" . round1($cur_queued['FileSizeLo'] / 1024 / 1024) . " MB</td>"; echo '</tr>'; } echo '</table>'; if ($cnt > $FilesPerPage) { pagelist($cnt, $page, $FilesPerPage, 'page'); } echo '</div>'; }
function printTagsPickerUl($preselect = NULL, $input_name = "taglist") { global $target_given_tags; if ($preselect === NULL) { $preselect = $target_given_tags; } foreach ($preselect as $key => $value) { # readable time format $preselect[$key]['time_parsed'] = formatAge($value['time']); } usort($preselect, 'cmpTags'); $preselect_hidden = ""; foreach ($preselect as $value) { $preselect_hidden .= "<input type=hidden name=" . $input_name . "[] value=" . $value['id'] . ">"; } echo $preselect_hidden; # print preselected tags id that used in case javascript problems echo "<ul data-tagit='yes' data-tagit-valuename='" . $input_name . "' data-tagit-preselect='" . json_encode($preselect) . "' class='tagit-vertical'></ul>"; }
function renderDeployQueue() { global $nextorder, $dqtitle; $order = 'odd'; $dqcode = getBypassValue(); $allq = get8021QDeployQueues(); foreach ($allq as $qcode => $data) { if ($dqcode == $qcode) { echo "<h2 align=center>Queue '" . $dqtitle[$qcode] . "' (" . count($data) . ")</h2>"; if (!count($data)) { continue; } echo '<table cellspacing=0 cellpadding=5 align=center class=widetable>'; echo '<tr><th>switch</th><th>changed</th><th>'; foreach ($data as $item) { echo "<tr class=row_{$order}><td>"; renderCell(spotEntity('object', $item['object_id'])); echo "</td><td>" . formatAge($item['last_change']) . "</td></tr>"; $order = $nextorder[$order]; } echo '</table>'; } } }
function renderIPv6NetworkAddresses($netinfo) { global $pageno, $tabno, $aac2; echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center' width='100%'>\n"; echo "<tr><th>Address</th><th>Name</th><th>Comment</th><th>Allocation</th></tr>\n"; $hl_ip = NULL; if (isset($_REQUEST['hl_ip'])) { $hl_ip = ip6_parse($_REQUEST['hl_ip']); addAutoScrollScript('ip-' . ip6_format($hl_ip)); } $addresses = $netinfo['addrlist']; ksort($addresses); markupIPAddrList($addresses); // pager $maxperpage = getConfigVar('IPV4_ADDRS_PER_PAGE'); if (count($addresses) > $maxperpage && $maxperpage > 0) { $page = isset($_REQUEST['pg']) ? $_REQUEST['pg'] : (isset($hl_ip) ? getPageNumOfIPv6($addresses, $hl_ip, $maxperpage) : 0); $numpages = ceil(count($addresses) / $maxperpage); echo "<center><h3>{$numpages} pages:</h3>"; for ($i = 0; $i < $numpages; $i++) { if ($i == $page) { echo "<b>{$i}</b> "; } else { echo "<a href='" . makeHref(array('page' => $pageno, 'tab' => $tabno, 'id' => $netinfo['id'], 'pg' => $i)) . "'>{$i}</a> "; } } echo "</center>"; } $i = 0; $interruped = FALSE; $prev_ip = ip_prev($netinfo['ip_bin']); foreach ($addresses as $ip_bin => $addr) { if (isset($page)) { ++$i; if ($i <= $maxperpage * $page) { continue; } elseif ($i > $maxperpage * ($page + 1)) { $interruped = TRUE; break; } } if ($ip_bin != ip_next($prev_ip)) { renderSeparator(ip_next($prev_ip), ip_prev($ip_bin), $hl_ip); } $prev_ip = $ip_bin; // render IP change history $title = ''; $history_class = ''; if (isset($addr['last_log'])) { $title = ' title="' . htmlspecialchars($addr['last_log']['user'] . ', ' . formatAge($addr['last_log']['time']), ENT_QUOTES) . '"'; $history_class = 'hover-history underline'; } $tr_class = $addr['class'] . ' tdleft' . ($hl_ip === $ip_bin ? ' highlight' : ''); echo "<tr class='{$tr_class}'>"; echo "<td><a class='ancor {$history_class}' {$title} name='ip-{$addr['ip']}' href='" . makeHref(array('page' => 'ipaddress', 'ip' => $addr['ip'])) . "'>{$addr['ip']}</a></td>"; $editable = empty($addr['allocs']) || !empty($addr['name']) && permitted('ipaddress', 'properties', 'editAddress') ? 'editable' : ''; echo "<td><span class='rsvtext {$editable} id-{$addr['ip']} op-upd-ip-name'>{$addr['name']}</span></td>"; echo "<td><span class='rsvtext {$editable} id-{$addr['ip']} op-upd-ip-comment'>{$addr['comment']}</span></td><td>"; $delim = ''; if ($addr['reserved'] == 'yes') { echo "<strong>RESERVED</strong> "; $delim = '; '; } foreach ($addr['allocs'] as $ref) { echo $delim . $aac2[$ref['type']]; echo "<a href='" . makeHref(array('page' => 'object', 'object_id' => $ref['object_id'], 'tab' => 'default', 'hl_ip' => $addr['ip'])) . "'>"; echo $ref['name'] . (!strlen($ref['name']) ? '' : '@'); echo "{$ref['object_name']}</a>"; $delim = '; '; } if ($delim != '') { $delim = '<br>'; } foreach ($addr['vslist'] as $vs_id) { $vs = spotEntity('ipv4vs', $vs_id); echo "{$delim}<a href='" . makeHref(array('page' => 'ipv4vs', 'vs_id' => $vs['id'])) . "'>"; echo "{$vs['name']}:{$vs['vport']}/{$vs['proto']}</a>→"; $delim = '<br>'; } foreach ($addr['rsplist'] as $rsp_id) { $rsp = spotEntity('ipv4rspool', $rsp_id); echo "{$delim}→<a href='" . makeHref(array('page' => 'ipv4rspool', 'pool_id' => $rsp['id'])) . "'>"; echo "{$rsp['name']}</a>"; $delim = '<br>'; } echo "</td></tr>\n"; } if (!$interruped) { renderSeparator(ip_next($prev_ip), ip_last($netinfo), $hl_ip); } if (isset($page)) { // bottom pager echo "<tr><td colspan=3>"; if ($page > 0) { echo "<a href='" . makeHref(array('page' => $pageno, 'tab' => $tabno, 'id' => $netinfo['id'], 'pg' => $page - 1)) . "'><< prev</a> "; } if ($page < $numpages - 1) { echo "<a href='" . makeHref(array('page' => $pageno, 'tab' => $tabno, 'id' => $netinfo['id'], 'pg' => $page + 1)) . "'>next >></a> "; } echo "</td></tr>"; } echo "</table>"; if (permitted(NULL, NULL, 'set_reserve_comment')) { addJS('js/inplace-edit.js'); } }
/** * Format study folder name in a consitent manner * @param string $raw_date * @param int $raw_age * @param string $raw_description */ function formatStudy($raw_date, $raw_age, $raw_description) { $date = str_replace('-', '.', $raw_date); $age = formatAge($raw_age); $description = sanitize($raw_description); return $date . '-' . $age . '-' . $description; }
function serializeTags($chain, $baseurl = '') { $tmp = array(); usort($chain, 'cmpTags'); foreach ($chain as $taginfo) { if ($baseurl == '') { $tmp[] = $taginfo['tag']; } else { $title = ''; if (isset($taginfo['user']) and isset($taginfo['time'])) { $title = 'title="' . htmlspecialchars($taginfo['user'] . ', ' . formatAge($taginfo['time']), ENT_QUOTES) . '"'; } $tmp[] = "<a {$title} href='{$baseurl}cft[]={$taginfo['id']}'>" . $taginfo['tag'] . "</a>"; } } return implode(', ', $tmp); }
function serializeTags($chain, $baseurl = '') { $tmp = array(); usort($chain, 'cmpTags'); foreach ($chain as $taginfo) { $title = ''; if (isset($taginfo['user']) and isset($taginfo['time'])) { $title = 'title="' . htmlspecialchars($taginfo['user'] . ', ' . formatAge($taginfo['time']), ENT_QUOTES) . '"'; } $class = ''; if (isset($taginfo['id'])) { $class = 'class="' . getTagClassName($taginfo['id']) . '"'; } $href = ''; if ($baseurl == '') { $tag = 'span'; } else { $tag = 'a'; $href = "href='{$baseurl}cft[]={$taginfo['id']}'"; } $tmp[] = "<{$tag} {$href} {$title} {$class}>" . $taginfo['tag'] . "</{$tag}>"; } return implode(', ', $tmp); }