|
|
@ -90,65 +90,61 @@ class Nex implements MessageComponentInterface |
|
|
|
$request |
|
|
|
$request |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Make sure realpath valid to continue |
|
|
|
// Route |
|
|
|
if ($this->_filesystem->valid($realpath)) |
|
|
|
switch (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Route |
|
|
|
// File request |
|
|
|
switch (true) |
|
|
|
case $file = $this->_filesystem->file($realpath): |
|
|
|
{ |
|
|
|
|
|
|
|
// File request |
|
|
|
|
|
|
|
case $file = $this->_filesystem->file($realpath): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Return file content |
|
|
|
// Return file content |
|
|
|
$response = $file; |
|
|
|
$response = $file; |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
// Directory request |
|
|
|
// Directory request |
|
|
|
case $list = $this->_filesystem->list($realpath): |
|
|
|
case $list = $this->_filesystem->list($realpath): |
|
|
|
|
|
|
|
|
|
|
|
// Try index file on defined |
|
|
|
// Try index file on defined |
|
|
|
if ($index = $this->_filesystem->file($realpath . $this->_environment->get('file'))) |
|
|
|
if ($index = $this->_filesystem->file($realpath . $this->_environment->get('file'))) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Return index file content |
|
|
|
// Return index file content |
|
|
|
$response = $index; |
|
|
|
$response = $index; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Listing enabled |
|
|
|
// Listing enabled |
|
|
|
else if ($this->_environment->get('list')) |
|
|
|
else if ($this->_environment->get('list')) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// FS map |
|
|
|
|
|
|
|
$line = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($list as $item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// FS map |
|
|
|
// Build gemini text link |
|
|
|
$line = []; |
|
|
|
$link = ['=>']; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($list as $item) |
|
|
|
if ($item['name']) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Build gemini text link |
|
|
|
$link[] = $item['file'] ? $item['name'] |
|
|
|
$link = ['=>']; |
|
|
|
: $item['name'] . '/'; |
|
|
|
|
|
|
|
} |
|
|
|
if ($item['name']) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$link[] = $item['file'] ? $item['name'] |
|
|
|
|
|
|
|
: $item['name'] . '/'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($item['time'] && $this->_environment->get('time')) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$link[] = date('Y-m-d', $item['time']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Append link to the new line |
|
|
|
if ($item['time'] && $this->_environment->get('time')) |
|
|
|
$line[] = implode(' ', $link); |
|
|
|
{ |
|
|
|
|
|
|
|
$link[] = date('Y-m-d', $item['time']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Merge lines to response |
|
|
|
// Append link to the new line |
|
|
|
$response = implode( |
|
|
|
$line[] = implode(' ', $link); |
|
|
|
PHP_EOL, |
|
|
|
|
|
|
|
$line |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
// Merge lines to response |
|
|
|
} |
|
|
|
$response = implode( |
|
|
|
|
|
|
|
PHP_EOL, |
|
|
|
|
|
|
|
$line |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Dump event |
|
|
|
// Dump event |
|
|
|