$du3 = formatSize($du3);
$ftp3_t = formatSize($ftp3_t);
/* ----------------- FTP 3 --------------- */
/* ----------------- FTP 4 --------------- */
/* get disk space free (in bytes) */
$ftp4_f = disk_free_space("/var/www/html/directlink/FTP4");
/* and get disk space total (in bytes) */
$ftp4_t = disk_total_space("/var/www/html/directlink/FTP4");
/* now we calculate the disk space used (in bytes) */
$du4 = $ftp4_t - $ftp4_f;
/* percentage of disk used - this will be used to also set the width % of the progress bar */
$dp4 = sprintf('%.2f', $du4 / $ftp4_t * 100);
/* and we formate the size from bytes to MB, GB, etc. */
$ftp4_f = formatSize($ftp4_f);
$du4 = formatSize($du4);
$ftp4_t = formatSize($ftp4_t);
/* ----------------- FTP 4 --------------- */
function formatSize($bytes)
{
$types = array('B', 'KB', 'MB', 'GB', 'TB');
for ($i = 0; $bytes >= 1024 && $i < count($types) - 1; $bytes /= 1024, $i++) {
}
return round($bytes, 2) . " " . $types[$i];
}
?>
<style type='text/css'>
body {
background: #f3f3f3;
}
开发者ID:pavs,项目名称:disk-stats,代码行数:31,代码来源:index.php
示例9: showPhoto
//.........这里部分代码省略.........
document.location.href = "index.php?uid=' . $uid . '&cid=' . $urlcid . '&pid=' . $prev . '";
break;
}
}
document.onkeydown = keyHandler;
</script>';
}
// special view detail
$special = '
<div id="special">
' . T_('From the Category:') . ' <a href="?uid=' . $r['uid'] . '&cid=' . $r['cid'] . '">' . cleanOutput($r['category_name']) . '</a>
' . T_('by') . '
<a class="u" href="../profile.php?member=' . $r['uid'] . '">' . $displayname . '</a>
</div>';
// if breadcrumbs haven't been defined, give the default
if ($breadcrumbs == '') {
$breadcrumbs = '
<a href="?uid=0">' . T_('Members') . '</a> >
<a href="?uid=' . $uid . '">' . $displayname . '</a> >
<a href="?uid=' . $uid . '&cid=' . $cid . '">' . cleanOutput($r['category_name']) . '</a>
' . $photos_of;
$special = '';
}
// setup some vars to hold photo details
if ($r['filename'] == 'noimage.gif' && $r['external_id'] != null) {
$photo_path_middle = $r['medium'];
$photo_path_full = $r['full'];
$size = T_('Unknown');
} else {
$photo_path = $this->getPhotoPath($r['filename'], $r['uid']);
$photo_path_middle = $photo_path[0];
$photo_path_full = $photo_path[1];
$size = filesize($photo_path_full);
$size = formatSize($size);
}
$r['user'] = $r['uid'];
// Figure out where we are currently saving photos, and create new destination object
$photoDestinationType = getDestinationType() . 'PhotoGalleryDestination';
$photoDestination = new $photoDestinationType($this->fcmsError, $this->fcmsUser);
$mediumSrc = $this->getPhotoSource($r, 'medium');
$fullSrc = $this->getPhotoSource($r, 'full');
$caption = cleanOutput($r['caption']);
$dimensions = $photoDestination->getImageSize($photo_path_full);
$date_added = fixDate(T_('F j, Y g:i a'), $this->fcmsUser->tzOffset, $r['date']);
// Calculate rating
if ($r['votes'] <= 0) {
$rating = 0;
$width = 0;
} else {
$rating = $r['rating'] / $r['votes'] * 100;
$rating = round($rating, 0);
$width = $rating / 5;
}
// Get Tagged Members
$sql = "SELECT u.`id`, u.`fname`, u.`lname` \n FROM `fcms_users` AS u, `fcms_gallery_photos_tags` AS t \n WHERE t.`photo` = '{$pid}' \n AND t.`user` = u.`id`\n ORDER BY u.`lname`";
$rows = $this->fcmsDatabase->getRows($sql, $pid);
if ($rows === false) {
$this->fcmsError->displayError();
return;
}
$tagged_mem_list = '<li>' . T_('none') . '</li>';
if (count($rows) > 0) {
$tagged_mem_list = '';
foreach ($rows as $t) {
$taggedName = cleanOutput($t['fname']) . ' ' . cleanOutput($t['lname']);
$tagged_mem_list .= '<li><a href="?uid=0&cid=' . $t['id'] . '" ';
//.........这里部分代码省略.........
if ($mta == 'postfix' && $_SESSION['user_type'] == 'A') {
if (is_readable($incomingdir) && is_readable($outgoingdir)) {
$inq = postfixinq();
$outq = postfixallq() - $inq;
echo ' <tr><td colspan="3" class="heading" align="center">Mail Queues</td></tr>' . "\n";
echo ' <tr><td colspan="2"><a href="postfixmailq.php">Inbound:</a></td><td align="right">' . $inq . '</td>' . "\n";
echo ' <tr><td colspan="2"><a href="postfixmailq.php">Outbound:</a></td><td align="right">' . $outq . '</td>' . "\n";
} else {
echo ' <tr><td colspan="3">Please verify read permissions on ' . $incomingdir . ' and ' . $outgoingdir . '</td></tr>' . "\n";
}
// else use mailq which is for sendmail and exim
} elseif (MAILQ && $_SESSION['user_type'] == 'A') {
$inq = mysql_result(dbquery("SELECT COUNT(*) FROM inq WHERE " . $_SESSION['global_filter']), 0);
$outq = mysql_result(dbquery("SELECT COUNT(*) FROM outq WHERE " . $_SESSION['global_filter']), 0);
echo ' <tr><td colspan="3" class="heading" align="center">Mail Queues</td></tr>' . "\n";
echo ' <tr><td colspan="2"><a href="mailq.php?queue=inq">Inbound:</a></td><td align="right">' . $inq . '</td>' . "\n";
echo ' <tr><td colspan="2"><a href="mailq.php?queue=outq">Outbound:</a></td><td align="right">' . $outq . '</td>' . "\n";
}
// drive display
if ($_SESSION['user_type'] == 'A') {
echo ' <tr><td colspan="3" class="heading" align="center">' . __('freedspace03') . '</td></tr>' . "\n";
foreach (get_disks() as $disk) {
$free_space = disk_free_space($disk['mountpoint']);
$total_space = disk_total_space($disk['mountpoint']);
if (round($free_space / $total_space, 2) <= 0.1) {
$percent = '<span style="color:red">';
} else {
$percent = '<span>';
}
$percent .= ' [';
$percent .= round($free_space / $total_space, 2) * 100;
$percent .= '%] ';
$percent .= '</span>';
echo ' <tr><td>' . $disk['mountpoint'] . '</td><td colspan="2" align="right">' . formatSize($free_space) . $percent . '</td>' . "\n";
}
}
echo ' </table>' . "\n";
echo ' </td>' . "\n";
}
echo '<td align="center" valign="top">' . "\n";
$sql = "\n SELECT\n COUNT(*) AS processed,\n SUM(\n CASE WHEN (\n (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n AND (ismcp=0 OR ismcp IS NULL)\n AND (ishighmcp=0 OR ishighmcp IS NULL)\n ) THEN 1 ELSE 0 END\n ) AS clean,\n ROUND((\n SUM(\n CASE WHEN (\n (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n AND (ismcp=0 OR ismcp IS NULL)\n AND (ishighmcp=0 OR ishighmcp IS NULL)\n ) THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS cleanpercent,\n SUM(\n CASE WHEN\n virusinfected>0\n THEN 1 ELSE 0 END\n ) AS viruses,\n ROUND((\n SUM(\n CASE WHEN\n virusinfected>0\n THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS viruspercent,\n SUM(\n CASE WHEN\n nameinfected>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n ) AS blockedfiles,\n ROUND((\n SUM(\n CASE WHEN\n nameinfected>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS blockedfilespercent,\n SUM(\n CASE WHEN\n otherinfected>0\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n ) AS otherinfected,\n ROUND((\n SUM(\n CASE WHEN\n otherinfected>0\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS otherinfectedpercent,\n SUM(\n CASE WHEN\n isspam>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n ) AS spam,\n ROUND((\n SUM(\n CASE WHEN\n isspam>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS spampercent,\n SUM(\n CASE WHEN\n ishighspam>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n THEN 1 ELSE 0 END\n ) AS highspam,\n ROUND((\n SUM(\n CASE WHEN\n ishighspam>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS highspampercent,\n SUM(\n CASE WHEN\n ismcp>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n AND (ishighmcp=0 OR ishighmcp IS NULL)\n THEN 1 ELSE 0 END\n ) AS mcp,\n ROUND((\n SUM(\n CASE WHEN\n ismcp>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n AND (ishighmcp=0 OR ishighmcp IS NULL)\n THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS mcppercent,\n SUM(\n CASE WHEN\n ishighmcp>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n ) AS highmcp,\n ROUND((\n SUM(\n CASE WHEN\n ishighmcp>0\n AND (virusinfected=0 OR virusinfected IS NULL)\n AND (nameinfected=0 OR nameinfected IS NULL)\n AND (otherinfected=0 OR otherinfected IS NULL)\n AND (isspam=0 OR isspam IS NULL)\n AND (ishighspam=0 OR ishighspam IS NULL)\n THEN 1 ELSE 0 END\n )/COUNT(*))*100,1\n ) AS highmcppercent,\n SUM(size) AS size\n FROM\n maillog\n WHERE\n date = CURRENT_DATE()\n AND\n " . $_SESSION['global_filter'] . "\n";
$sth = dbquery($sql);
while ($row = mysql_fetch_object($sth)) {
echo '<table border="0" cellpadding="1" cellspacing="1" class="mail" width="200">' . "\n";
echo ' <tr><th align="center" colspan="3">' . __('todaystotals03') . '</th></tr>' . "\n";
echo ' <tr><td>' . __('processed03') . ':</td><td align="right">' . number_format($row->processed) . '</td><td align="right">' . format_mail_size($row->size) . '</td></tr>' . "\n";
echo ' <tr><td>' . __('cleans03') . ':</td><td align="right">' . number_format($row->clean) . '</td><td align="right">' . $row->cleanpercent . '%</td></tr>' . "\n";
echo ' <tr><td>' . __('viruses03') . ':</td><td align="right">' . number_format($row->viruses) . '</td><td align="right">' . $row->viruspercent . '%</tr>' . "\n";
echo ' <tr><td>Top Virus:</td><td colspan="2" align="right" style="white-space:nowrap">' . return_todays_top_virus() . '</td></tr>' . "\n";
echo ' <tr><td>' . __('blockedfiles03') . ':</td><td align="right">' . number_format($row->blockedfiles) . '</td><td align="right">' . $row->blockedfilespercent . '%</td></tr>' . "\n";
echo ' <tr><td>' . __('others03') . ':</td><td align="right">' . number_format($row->otherinfected) . '</td><td align="right">' . $row->otherinfectedpercent . '%</td></tr>' . "\n";
echo ' <tr><td>Spam:</td><td align="right">' . number_format($row->spam) . '</td><td align="right">' . $row->spampercent . '%</td></tr>' . "\n";
echo ' <tr><td style="white-space:nowrap">' . __('hscospam03') . ':</td><td align="right">' . number_format($row->highspam) . '</td><td align="right">' . $row->highspampercent . '%</td></tr>' . "\n";
if (get_conf_truefalse('mcpchecks')) {
echo ' <tr><td>MCP:</td><td align="right">' . number_format($row->mcp) . '</td><td align="right">' . $row->mcppercent . '%</td></tr>' . "\n";
echo ' <tr><td style="white-space:nowrap">' . __('hscomcp03') . ':</td><td align="right">' . number_format($row->highmcp) . '</td><td align="right">' . $row->highmcppercent . '%</td></tr>' . "\n";
}
echo '</table>' . "\n";
}
// Navigation links - put them into an array to allow them to be switched
// on or off as necessary and to allow for the table widths to be calculated.
$nav = array();
$nav['status.php'] = __('recentmessages03');
if (LISTS) {
$nav['lists.php'] = __('lists03');
}
$row = $day == 'Saturday' || $day == 'Sunday' ? '3' : '1';
# Print log file row
echo <<<OUT
\t\t\t<tr class="row{$row}">
\t\t\t\t<td width="150">{$display}</td>
\t\t\t\t<td width="100">{$size}</td>
\t\t\t\t<td>
\t\t\t\t\t[<a href="{$self}?logs-view&file={$file}&show=raw" target="_blank" title="Opens in a new window">raw log</a>]
\t\t\t\t\t
\t\t\t\t\t[<a href="{$self}?logs-view&file={$file}&show=popular-sites">popular sites</a>]
\t\t\t\t</td>
\t\t\t</tr>
OUT;
}
# End table
$total = formatSize($totalSize);
echo <<<OUT
\t\t</table>
\t\t<p>Total space used by logs: <b>{$total}</b></p>
\t\t<p class="little">Note: Raw logs open in a new window.</p>
\t\t<p class="little">Note: You can set up your proxy to automatically delete old logs with the maintenance feature.</p>
OUT;
break;
/*****************************************************************
* LOG VIEWER
******************************************************************/
/*****************************************************************
* LOG VIEWER
******************************************************************/
case 'logs-view':
$output->title = 'view log';
请发表评论