',implode(array_map(function($row){echo gzinflate($row);},$rows)),''; $rows = $size; } function add($number, $name, $single='', $plural='s') { return $number.' '._($name.($number==1 ? $single : $plural)); } function parent_link() { global $dir,$path; $parent = dirname($dir); return $parent=='/' ? false : ''._('Parent Directory').''; } function my_devs(&$devs) { global $disks,$lock; $text = []; $i = 0; foreach ($devs as $dev) { if ($lock=='---') { $text[$i] = ' ---'; } else { switch ($disks[$dev]['luksState']??0) { case 0: $text[$i] = ""._('Not encrypted').""; break; case 1: $text[$i] = ""._('Encrypted and unlocked').""; break; case 2: $text[$i] = ""._('Locked: missing encryption key').""; break; case 3: $text[$i] = ""._('Locked: wrong encryption key').""; break; default: $text[$i] = ""._('Locked: unknown error').""; break; } $text[$i] .= compress($dev,12,0); } $i++; } return implode($text); } extract(parse_plugin_cfg('dynamix',true)); $disks = parse_ini_file('state/disks.ini',true); $shares = parse_ini_file('state/shares.ini',true); $dir = realpath(htmlspecialchars_decode(rawurldecode($_GET['dir']))); $path = unscript($_GET['path']); $fmt = "%F {$display['time']}"; $dirs = $files = []; $total = $objs = 0; [$null,$root,$main,$rest] = my_explode('/',$dir,4); $user = $root=='mnt' && in_array($main,['user','user0']); $lock = $root=='mnt' ? ($main ?: '---') : ($root=='boot' ? _('flash') : '---'); if ($user) { exec("shopt -s dotglob; getfattr --no-dereference --absolute-names -n system.LOCATIONS ".escapeshellarg($dir)."/* 2>/dev/null",$tmp); for ($i = 0; $i < count($tmp); $i+=3) $set[basename($tmp[$i])] = explode('"',$tmp[$i+1])[1]; unset($tmp); } $stat = popen("shopt -s dotglob; stat -L -c'%F|%s|%Y|%n' ".escapeshellarg($dir)."/* 2>/dev/null",'r'); while (($row = fgets($stat))!==false) { [$type,$size,$time,$name] = explode('|',rtrim($row,"\n"),4); $dev = explode('/',$name,5); $devs = explode(',',$user ? $set[basename($name)]??$shares[$dev[3]]['cachePool']??'' : $lock); $objs++; $text = []; if ($type[0]=='d') { $text[] = ""; $text[] = "
"; $text[] = "".htmlspecialchars(basename($name)).""; $text[] = "<"._('FOLDER').">"; $text[] = "".my_time($time,$fmt).""; $text[] = "".my_devs($devs).""; $text[] = ""; $dirs[] = gzdeflate(implode($text)); } else { $ext = strtolower(pathinfo($name,PATHINFO_EXTENSION)); $tag = count($devs)>1 ? 'warning' : ''; $text[] = ""; $text[] = "
"; $text[] = "".htmlspecialchars(basename($name)).""; $text[] = "".my_scale($size,$unit)." $unit"; $text[] = "".my_time($time,$fmt).""; $text[] = "".my_devs($devs).""; $text[] = ""; $files[] = gzdeflate(implode($text)); $total += $size; } } pclose($stat); if ($link = parent_link()) echo "
$link"; echo write($dirs),write($files),'',add($objs,'object'),': ',add($dirs,'director','y','ies'),', ',add($files,'file'),' (',my_scale($total,$unit),' ',$unit,' ',_('total'),')'; ?>