public function changeStorDirectoryAction()
 {
     $chosen = $this->getRequest()->getParam("dir");
     $element = $this->getRequest()->getParam("element");
     $watched_dirs_form = new Application_Form_WatchedDirPreferences();
     $res = MusicDir::setStorDir($chosen);
     if ($res['code'] != 0) {
         $watched_dirs_form->populate(array('storageFolder' => $chosen));
         $watched_dirs_form->getElement($element)->setErrors(array($res['error']));
     }
     $this->view->subform = $watched_dirs_form->render();
 }
Exemplo n.º 2
0
 public function setStorageDirAction()
 {
     global $CC_CONFIG;
     $request = $this->getRequest();
     $api_key = $request->getParam('api_key');
     $path = base64_decode($request->getParam('path'));
     if (!in_array($api_key, $CC_CONFIG["apiKey"])) {
         header('HTTP/1.0 401 Unauthorized');
         print 'You are not allowed to access this resource.';
         exit;
     }
     $this->view->msg = MusicDir::setStorDir($path);
 }