Exemplo n.º 1
0
 public function listAllWatchedDirsAction()
 {
     global $CC_CONFIG;
     $request = $this->getRequest();
     $api_key = $request->getParam('api_key');
     if (!in_array($api_key, $CC_CONFIG["apiKey"])) {
         header('HTTP/1.0 401 Unauthorized');
         print 'You are not allowed to access this resource.';
         exit;
     }
     $result = array();
     $arrWatchedDirs = MusicDir::getWatchedDirs();
     $storDir = MusicDir::getStorDir();
     $result[$storDir->getId()] = $storDir->getDirectory();
     foreach ($arrWatchedDirs as $watchedDir) {
         $result[$watchedDir->getId()] = $watchedDir->getDirectory();
     }
     $this->view->dirs = $result;
 }