return;
}
+ function index()
+ {
+ $this->handler;
+ if (empty($this->handler)) {
+ return;
+ }
+ $User = NULL;
+ $Page = $this;
+ $res = include "./{$this->handler}/index.php";
+ return $res;
+ }
+
function restricted()
{
$this->handler;
}
function name()
{
- return $this->safetitle ?: $this->link;
+ return $this->safetitle ?: htmlspecialchars($this->link);
}
function last()
function thumb($size = '300x')
{
if (!$this->image or $this->image[0] !== '/') return;
+ if (preg_match('{^/thumb/\D}', $this->image)) {
+ return ltrim($this->image, '/');
+ }
return preg_replace(
['{^(?:/thumb/[^/]*)?}', '/\.groot(?=\.\w+$)/'], ["thumb/$size", ''],
$this->image
class PageSearch
{
+ public $handlers = [];
+
function __construct($path = '.')
{
$this->iterator = new RecursiveCallbackFilterIterator(
# skip hidden files and directories
return FALSE;
}
+ if (file_exists($current->getFilename() . '/index.php')) {
+ # contents better provided by handler code
+ $this->handlers[ $current->getPathname() ] = $current;
+ return FALSE;
+ }
if ($current->isLink()) {
# ignore symlinks, original contents only
return FALSE;
function files()
{
# order alphabetically by link
- $dir = iterator_to_array(new RecursiveIteratorIterator($this->iterator));
- array_walk($dir, function (&$row, $name) {
- # prepare values for sorting (directory index first)
- $row = preg_replace('{/index\.html$}', '', $name);
- });
- asort($dir);
+ $dir = [];
+ foreach (new RecursiveIteratorIterator($this->iterator) as $name) {
+ $article = new ArchiveArticle($name);
+ $dir[$article->link] = $article;
+ }
+ ksort($dir);
return $dir;
}
}