public function filelist() { $mp3s = $directories = $current = array(); if (!empty($_GET['dir'])) { $currentDir = urldecode($_GET['dir']); } else { $currentDir = ''; } $contents = mpc::ls($currentDir); natcasesort($contents); foreach ($contents as $value) { if (strpos($value, '/') > 0) { $value = substr($value, strrpos($value, '/') + 1); } if (strtolower(substr($value, -4)) == ".mp3") { $mp3s[] = $value; } else { $directories[$value] = $currentDir . '/' . $value; } } if (!empty($currentDir)) { $directories = array('up' => substr($currentDir, 0, strrpos($currentDir, '/'))) + $directories; } return array('files' => $mp3s, 'directories' => $directories, 'currentDir' => $currentDir); }
public function updateDatabase() { $this->setView('admin'); mpc::update(); $this->notice("Updating databases...may take awhile", '/admin'); }