$formhomedir = preg_replace('/.*\\/home\\/content/', '', $_SERVER['DOCUMENT_ROOT']); $formhomedir = explode('/', $formhomedir); if (count($formhomedir) <= 4) { $formhome = "/home/content/" . $formhomedir[1] . "/" . $formhomedir[2] . "/data/"; } else { $formhome = "/home/content/" . $formhomedir[1] . "/" . $formhomedir[2] . "/" . $formhomedir[3] . "/" . $formhomedir[4] . "/data/"; } $file_order = ".default"; $file_format = ".text"; $file_interval = ".15m"; $field_order = ""; if (isset($query_vars['form_order'])) { if ($query_vars['form_order'] != "alpha") { $field_order = $query_vars['form_order']; $file_order = ".custom"; $query_vars = customsort($query_vars, $field_order); } else { switch ($query_vars['form_order']) { case "alpha": uksort($query_vars, 'strnatcasecmp'); $file_order = ".alpha"; break; default: $file_order = ".default"; break; } } } if (isset($query_vars['form_format'])) { switch ($query_vars['form_format']) { case "csv":
$file['perms'] = substr(sprintf('%o', fileperms($file['raw'])), -3); $templist[$n]['perms'] = $conf['FilePermsType'] == 'symbolic' ? oct2sym($file['perms']) : $file['perms']; } if ($conf['ShowModTimes']) { $file['modtime'] = filemtime($file['raw']); $templist[$n]['modtime'] = $file['modtime']; } if ($conf['ShowFileCount']) { $count[$file['type']]++; } } } // Sorting // customsort() checks the config options, so no check is needed here // See functions.php for more details customsort($templist); } $filecount = count($templist); // Check if the list contains any items if ($filecount > 0) { // Assemble the final list foreach ($templist as $n => $tlval) { $list[$n]['name'] = '<a class="' . $tlval['type'] . '" href="' . $tlval['link'] . '">' . htmlentities($tlval['name']) . '</a>'; // Has user asked for PHP files to be displayed as source instead of run? if ($conf['ShowPHPSource']) { // Yes, see if this is a PHP file and, if so, make a link to display its source. if (substr($tlval['name'], -4, 4) == '.php') { $list[$n]['name'] = '<a class="' . $tlval['type'] . '" href="' . $resdir . '/showsource.php?file=../' . $tlval['link'] . '" target="_blank">' . htmlentities($tlval['name']) . '</a>'; } else { // Make it a regular link $list[$n]['name'] = '<a class="' . $tlval['type'] . '" href="' . $tlval['link'] . '">' . htmlentities($tlval['name']) . '</a>';