# Get system's description of file on *nix systems.
        if (bh_os() == "nix") {
            $cmdstr = "file -b " . escapeshellarg($fileobj->absfilepath);
            $systemdesc2 = `{$cmdstr}`;
            $systemdescarray = explode(",", $systemdesc2);
            $systemdesc = $systemdescarray[0];
            $systemdesc[0] = strtoupper($systemdesc[0]);
        } else {
            $systemdesc = strtoupper(bh_get_extension($file['filepath'])) . " file";
        }
        # Get any possible description from metadata
        if (!empty($fileobj->fileinfo['description'])) {
            $systemdesc = $fileobj->fileinfo['description'];
        } elseif (!empty($fileobj->fileinfo['desc'])) {
            $systemdesc = $fileobj->fileinfo['desc'];
        }
        # Stop JS/HTML insertion
        $systemdesc = strip_tags($systemdesc);
        if (empty($bhconfig['defaultfilemodule'])) {
            $defaultfilemodule = "viewfile";
        } else {
            $defaultfilemodule = $bhconfig['defaultfilemodule'];
        }
        if ($fileobj->is_dir() == true) {
            $str .= "<tr><td width='20'><a href='index.php?page=viewdir&filepath=" . $file['filepath'] . "'><img src='" . $this->geticon($file['filepath'], 16) . "' border='0'></a></td><td><a href='index.php?page=viewdir&filepath=" . $file['filepath'] . "' class='filenamelink'>" . $file['filename'] . "</a></td><td>" . $systemdesc . "</td><td>" . $fileobj->numberfiles() . $bhlang['label:_files'] . "</td></tr>";
        } else {
            $str .= "<tr><td width='20'><a href='index.php?page={$defaultfilemodule}&filepath=" . $file['filepath'] . "'><img src='" . $this->geticon($file['filepath'], 16) . "' border='0'></a></td><td><a href='index.php?page={$defaultfilemodule}&filepath=" . $file['filepath'] . "' class='filenamelink'>" . $file['filename'] . "</a></td><td>" . $systemdesc . "</td><td>" . bh_humanfilesize($file['filesize']) . "</td></tr>";
        }
    }
}
$str .= "\t\t</table><br>\n\t\t</td>\n\t\t<td width='10' background='" . $this->skinpath . "images/sidebar/rc.png'>&nbsp;</td>\n\t</tr>\n\t<tr height='10'>\n\t\t<td width='10'><img src='" . $this->skinpath . "images/sidebar/bl.png'></td>\n\t\t<td background='" . $this->skinpath . "images/sidebar/bc.png'></td>\n\t\t<td width='10'><img src='" . $this->skinpath . "images/sidebar/br.png'></td>\n\t</tr>\n</table>\n";
        } elseif (!empty($fileobj->fileinfo['desc'])) {
            $systemdesc = $fileobj->fileinfo['desc'];
        }
        # Stop JS/HTML insertion
        $systemdesc = strip_tags($systemdesc);
        # Get thumbnail
        $thumbpath = bh_thumbnail($file['filepath'], 128);
        if ($thumbpath == false) {
            $thumbpath = $this->geticon($file['filepath'], 128);
        }
        if (empty($bhconfig['defaultfilemodule'])) {
            $defaultfilemodule = "viewfile";
        } else {
            $defaultfilemodule = $bhconfig['defaultfilemodule'];
        }
        if ($fileobj->is_dir() == true) {
            $str .= "<td align='center'>\n\t\t\t<table><tr height='128'><td style='border: 1px solid gray;' width='128' valign='middle' align='center'><a href='index.php?page=viewdir&filepath=" . $file['filepath'] . "'><img src='" . $thumbpath . "' border='0'></a></td></tr>\n\t\t\t<tr><td align='center' width='128'><a href='index.php?page=viewdir&filepath=" . $file['filepath'] . "' class='filenamelink'>" . $file['filename'] . "</a><br><font color='gray'>" . $systemdesc . "<br>" . $fileobj->numberfiles() . $bhlang['label:_files'] . "<br></font></td></tr></table></td>";
        } else {
            $str .= "<td align='center'>\n\t\t\t<table><tr height='128'><td style='border: 1px solid gray;' width='128' valign='middle' align='center'><a href='index.php?page={$defaultfilemodule}&filepath=" . $file['filepath'] . "'><img src='" . $thumbpath . "' border='0'></a></td></tr>\n\t\t\t<tr><td align='center' width='128'><a href='index.php?page={$defaultfilemodule}&filepath=" . $file['filepath'] . "' class='filenamelink'>" . $file['filename'] . "</a><br><font color='gray'>" . $systemdesc . "<br>" . bh_humanfilesize($file['filesize']) . "<br></font></td></tr></table></td>";
        }
        if ($even == 2) {
            $str .= "</tr>";
            $even = -1;
        }
        $even++;
    }
}
if ($even = 0) {
    $str .= "<td width='50'></td><td></td></tr>";
}
$str .= "\t\t</table><br>\n\t\t</td>\n\t\t<td width='10' background='" . $this->skinpath . "images/sidebar/rc.png'>&nbsp;</td>\n\t</tr>\n\t<tr height='10'>\n\t\t<td width='10'><img src='" . $this->skinpath . "images/sidebar/bl.png'></td>\n\t\t<td background='" . $this->skinpath . "images/sidebar/bc.png'></td>\n\t\t<td width='10'><img src='" . $this->skinpath . "images/sidebar/br.png'></td>\n\t</tr>\n</table>\n";
Exemple #3
0
            # If the username is not shown then don't show it
            if ($user == "guest") {
            } else {
                $thisuserobj = new bhuser($user);
                $usrimgfile = $thisuserobj->type . ".png";
                # This is pretty nasty. Lots of tables.
                # Note I use the humanfilesize() function here for bandwidth - it's bytes all the way, so it sort of makes sense.
                # Also, this is hardcoded to show last 30 days bandwidth. It may be possible to change this on the user end in the future.
                # Also note that getbandwidth() accepts a third parameter, end time. Might use it for graphs.
                #
                #                           sec  min  hr  days (rounded)
                $bandwidthstart = time() - 60 * 60 * 24 * 30;
                #
                # e.g. for a year
                #$bandwidthstart = time() - (60 * 60 * 24 * 356);
                #
                # or for last week
                #$bandwidthstart = time() - (60 * 60 * 24 * 7);
                #
                # or yesterday
                #$bandwidthstart = time() - (60 * 60 * 24);
                # etc.
                $str .= "\n\t\t\t<tr><td><img src='" . $this->skinpath . "images/userslist/" . $usrimgfile . "' title='" . $thisuserobj->type . "'></td>\n\t\t\t<td>&nbsp; &nbsp; </td>\n\t\t\t<td align='center'><a href='index.php?page=edituser&username="******"' style='text-decoration:none; color: black;'><b>" . $thisuserobj->username . "</b></a></td>\n\t\t\t<td align='center'> &nbsp; &nbsp; &nbsp; &nbsp; <img src='" . $this->skinpath . "images/userslist/disk.png' alt='" . $bhlang['label:disk_space_used'] . "' title='" . $bhlang['label:disk_space_used'] . "'></td><td>&nbsp; " . bh_humanfilesize($thisuserobj->getusedspace()) . " &nbsp; &nbsp; &nbsp; &nbsp; </td>\n\t\t\t<td><table cellspacing='0'><tr><td><img src='" . $this->skinpath . "images/userslist/band_up.png'></td><td> &nbsp; " . bh_humanfilesize($thisuserobj->getbandwidth("up", $bandwidthstart)) . "</td></tr>\n\t\t\t<tr><td><img src='" . $this->skinpath . "images/userslist/band_down.png'></td><td> &nbsp; " . bh_humanfilesize($thisuserobj->getbandwidth("down", $bandwidthstart)) . "</td></tr></table></td>\n\t\t\t<td align='center'> &nbsp;<a href='index.php?page=edituser&username="******"' style='text-decoration:none; color: black;'>" . $bhlang['button:edit'] . "</a> &nbsp; &nbsp; <a href='index.php?page=deleteuser&username="******"' style='text-decoration:none; color: black;'>" . $bhlang['button:delete'] . "</a></td>\n\t\t\t</tr><tr height='5'></tr>";
            }
        }
        $str .= "</table></td></tr>";
    } else {
        $str .= "<tr bgcolor='#ECECEC'><td><a href='index.php?page=users&group=" . $group . "'><b><font color='#555555'>" . $group . "</font></b></a></td></tr>\n\r";
    }
}
$str .= "\n\t\t\t</table>\n\t\t\t<br><br>\n\t\t</td>\n\t\t<td width='10' background='" . $this->skinpath . "images/sidebar/rc.png'>&nbsp;</td>\n\t</tr>\n\t<tr height='10'>\n\t\t<td width='10'><img src='" . $this->skinpath . "images/sidebar/bl.png'></td>\n\t\t<td background='" . $this->skinpath . "images/sidebar/bc.png'></td>\n\t\t<td width='10'><img src='" . $this->skinpath . "images/sidebar/br.png'></td>\n\t</tr>\n</table>\n";