<?php
# ------------------------------------------------------------------------------
#
# Disk Free Space Portlet
#
# ------------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#
# This file is part of TVEz (tvez.sourceforge.net).
#
# TVEz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# TVEz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ------------------------------------------------------------------------------
#
# Created on 02/12/2003 by Christian Eheim (hide@address.com)
#
# LAST MODIFIED:
# $Date: 2004/01/25 02:11:33 $
# $Revision: 1.7 $
# $Author: eheim $
#
# ------------------------------------------------------------------------------
require "movies/portlets/root_dev.php";
$content = '<table border="0" width="100%">';
sort($MOVIE_DIRS);
# Find the root device
$rootdir = array();
foreach ($MOVIE_DIRS as $dir) {
array_push($rootdir,find_rootdev($dir));
}
foreach ($rootdir as $dir) {
if (!is_dir($dir)) continue;
$stat = stat($dir);
$dname{$stat[0]} = $dir;
$dspace{$stat[0]} = round(disk_free_space($dir)/1024/1024);
}
foreach ($dname as $key => $value) {
$content .= "<tr><td>$value</td><td align=\"right\">".$dspace{$key}." MB</td></tr>";
# $content .= "<tr><td class=\"portlet_content\">$value</td><td align=\"right\" class=\"portlet_content\">".$dspace{$key}." MB</td></tr>";
}
$content .= "</table>";
portlet(localize_string("Free Disk Space"),$content);
?>