예제 #1
0
 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);
 }
예제 #2
0
 public function updateDatabase()
 {
     $this->setView('admin');
     mpc::update();
     $this->notice("Updating databases...may take awhile", '/admin');
 }