better declarations an logical structure (in case we don't have perms to read)

World Wide Web Server 2012-07-04 16:04:08 -07:00
parent 61ce5065b0
commit d68538e5d2

@ -65,12 +65,11 @@ class Browser extends Controller {
// we'll need this to build links
$this->load->helper('url');
$dirs = array();
$files = array();
// let's traverse the directory
if ( $handle = opendir( $absolute_path ))
if ( $handle = @opendir( $absolute_path ))
{
$dirs = array();
$files = array();
while ( false !== ($file = readdir( $handle )))
{
if (( $file != "." AND $file != ".." ))
@ -89,11 +88,12 @@ class Browser extends Controller {
sort( $dirs );
sort( $files );
// parent directory, here to ensure it's the first in the array
if ( $path_in_url != '' )
array_unshift ( $dirs, array( 'name' => '..' ));
}
// parent directory
// here to ensure it's available and the first in the array
if ( $path_in_url != '' )
array_unshift ( $dirs, array( 'name' => '..' ));
// send the view
$data = array(