public function ListActive()
{
$active_list = array();
$tainted = false;
$root = WORKSPACE;
if ($this->actives) {
foreach ($this->actives as $active => $data) {
if (is_array($data) && isset($data['username']) && $data['username'] == $this->username) {
if ($this->isAbsPath($data['path'])) {
$root = "";
} else {
$root = $root . '/';
}
if (file_exists($root . $data['path'])) {
$focused = isset($data['focused']) ? $data['focused'] : false;
$active_list[] = array('path' => $data['path'], 'focused' => $focused);
} else {
unset($this->actives[$active]);
$tainted = true;
}
}
}
}
if ($tainted) {
saveJSON('active.php', $this->actives);
}
echo formatJSEND("success", $active_list);
}