Beispiel #1
0
 function HarddiskCrypt()
 {
     require './apps/harddiskcrypt/harddiskcrypt.php';
     $open = $this->app->Secure->GetGET('open');
     $close = $this->app->Secure->GetGET('close');
     $default = $this->app->Secure->GetGET('default');
     $freespace = FreeSpace('/dev/sda1');
     $totalspace = TotalSpace('/dev/sda1');
     $freespace_in_mb = floor($freespace / 1024);
     $totalspace_in_mb = floor($totalspace / 1024);
     $this->app->Tpl->Set('FREESPACE', $freespace_in_mb);
     $this->app->Tpl->Set('TOTALSPACE', $totalspace_in_mb);
     $drives = GetDrives();
     $out = '';
     $default = GetDefault();
     for ($i = 0; $i < count($drives); $i++) {
         $size = floor($drives[$i]['size'] / (1024 * 1024));
         $mount_name = NormalizeName($drives[$i]['name']);
         $active = IsMount($drives[$i]['name']) == '1' ? '<img src="./themes/fredgui/images/ok_arrow.png">' : '';
         $standard = $default == $drives[$i]['name'] ? '- default' : '';
         $out .= "<tr><td><b>{$drives[$i]['name']}</b> {$standard}</td><td>{$mount_name}</td><td>{$size} MB</td><td>{$active}</td>\n\t\t\t\t\t\t\t\t\t <!--<td><a href=\"index.php?module=filebrowser&action=list&path=/mnt/{$mount_name}\" class=\"blue\">&Ouml;ffnen</a>&nbsp;-->\n\t\t\t\t\t\t\t\t\t <td><a href=\"#\" onclick=\"OpenDrive('{$drives[$i]['name']}','index.php?module=filebrowser&action=list&path=/mnt/{$mount_name}')\" class=\"blue\">as web</a>&nbsp;|&nbsp;\n\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"Mount('{$drives[$i]['name']}')\" class=\"blue\">as stick</a>&nbsp;|&nbsp;\n\t\t\t\t\t\t\t\t\t \t\t <a href=\"#\" onclick=\"Unmount('{$drives[$i]['name']}')\" class=\"blue\">umount</a>&nbsp;|&nbsp;\n\t\t\t\t\t\t\t\t\t\t\t <!--<a href=\"#\" onclick=\"SetDefault('{$drives[$i]['name']}')\" class=\"blue\">Standard</a>&nbsp;|&nbsp;-->\n\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"DeleteDrive('{$drives[$i]['name']}')\" class=\"blue\">delete</a></td></tr>";
     }
     if (count($drives) == 0) {
         $out = '<tr><td colspan="3">no volumes are available!</td></tr>';
     }
     $this->app->Tpl->Set('DRIVESTABLE', $out);
     $this->app->Tpl->Parse(PAGE, "harddiskcrypt.tpl");
 }
function ListDrives($dir)
{
    $drives = GetDrives($dir);
    $total = floor(TotalSpace('/dev/sda1') / 1024);
    $free = floor(FreeSpace('/dev/sda1') / 1024);
    $data[] = array('name' => 'Free Space', 'size' => $free / $total);
    $drivesTotal = 0;
    for ($i = 0; $i < count($drives); $i++) {
        $size_in_mb = $drives[$i]['size'] / 1048576;
        $data[] = array('name' => $drives[$i]['name'], 'size' => $size_in_mb / $total);
    }
    return json_encode($data);
}