Sub Category issue with scandir function
Posted: Fri Mar 13, 2015 5:03 am
Hi guys,
I have a strange issue with scandir function in PHP. I have downloaded an open source PHP script and modify it a little bit. On the root directory everything is working just fine with my functions and variables. However, on every subcategory most of the variables that I am returning are not function at all. You can find attached two screenshots in order to get a better understanding.
Script attached too.
http://postimg.org/image/gjlrmamg3/
http://postimg.org/image/vrclhzinr/
Thank you in advance for your help!
I have a strange issue with scandir function in PHP. I have downloaded an open source PHP script and modify it a little bit. On the root directory everything is working just fine with my functions and variables. However, on every subcategory most of the variables that I am returning are not function at all. You can find attached two screenshots in order to get a better understanding.
Script attached too.
http://postimg.org/image/gjlrmamg3/
http://postimg.org/image/vrclhzinr/
Thank you in advance for your help!
Code: Select all
<?php
session_start();
ini_set('display_errors', 'on');
error_reporting(E_ERROR | E_PARSE);
date_default_timezone_set("Europe/Nicosia");
include("config2.php");
$title = "Software-Applications";
$ignore_file_list = array( ".htaccess", "_gsdata_" );
$ignore_ext_list = array("php", "css", "png");
$sort_by = "name_asc"; // options: name_asc, name_desc, date_asc, date_desc
$icon_url = "https://dl.dropbox.com/u/6771946/icons/icons.png";
?>
<!DOCTYPE HTML>
<head>
<title><?php echo $title; ?></title>
<link href="styles2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$sub = $_GET['dir']."/";
$full_path = "data_dir".$sub;
echo "Full path: ".$full_path."<br>";
echo "Sub dir: ".$sub; ?>
<?php
if (EMPTY($_GET['dir'])) {
$_SESSION['dir'];
$dir = $dir."/".$_SESSION['dir'];
}
else {
} ?>
<h1><?php echo $title ?></h1> <div class="wrap">
<?php
// GET THE BLOCKS STARTED, FALSE TO INDICATE MAIN FOLDER
$items = scandir($full_path);
foreach($items as $item) {
if( $item == ".." OR $item == ".") continue;
// IGNORE FILE
if(in_array($item, $ignore_file_list)) { continue; }
$file_ext = pathinfo($item, PATHINFO_EXTENSION);
// IGNORE EXT
if(in_array($file_ext, $ignore_ext_list)) { continue; }
if(!$file_ext AND is_dir($item)) { $file_ext = "dir"; }
//print_r($item);
if (is_dir($item) == TRUE) {$folder="index2.php?dir=/";} else $folder="";
?>
<div class="block">
<a href="<?php echo "$folder$item";?>" class="<?php echo $file_ext;?>">
<div class="img <?php echo $file_ext;?>"> </div>
<div class="name">
<div class="file"><?php echo basename($item)?> </div>
<div class="date">Size:<?php echo format_size($item)."<br/> Last modified: ".date("D. F jS, Y - h:ma", filemtime($item)) ?> </div>
</div>
</a>
</div>
<?php } ?>
</div>
</body>
</html>