return $this->$col = $this->$col(); # run method and cache
}
+ function rawname()
+ {
+ return @file_get_contents("{$this->dir}/name.txt");
+ }
+
function name()
{
- $name = @file_get_contents("{$this->dir}/name.txt");
- return htmlspecialchars(implode(' & ', explode("\n", $name)));
+ return htmlspecialchars(implode(' & ', explode("\n", $this->rawname)));
}
function admin()
$users[$col] = new User($userdir);
}
-if (@$Place['order'] == 'seen') {
- $order = array_map(function ($col) { return $col->seen; }, $users);
-# $order = array_column($users, 'seen'); #TODO php7 simplification
- array_multisort($order, SORT_DESC, SORT_NUMERIC, $users);
- $users = array_intersect_key($users, array_filter($order));
+if (isset($Place['order'])) {
+ $ordercol = $Place['order'];
+ $order = array_map(function ($row) use ($ordercol) {
+ return $row->$ordercol;
+ }, $users);
+# $order = array_column($users, $ordercol); #TODO php7 simplification
+ if ($ordercol == 'seen') {
+ array_multisort($order, SORT_DESC, SORT_NUMERIC, $users);
+ $users = array_intersect_key($users, array_filter($order));
+ }
+ else {
+ array_multisort($order, SORT_ASC, SORT_NATURAL, $users);
+ }
}
if (isset($Place['n'])) {