Exemplo n.º 1
0
 public function FtpEditFormSucceeded(Form $form, $values)
 {
     if (empty($values->id) && $values->export) {
         $this->share->insert(array('shareType_id' => self::shareType_id, 'folder_id' => $values->folder_id, 'var' => $values->username, 'var2' => $values->password));
         $this->flashMessage('FTP share byl úspěšně vytvořen.', 'success');
     } elseif (!empty($values->id) && !$values->export) {
         $this->share->find($values->id)->delete();
         $this->flashMessage('FTP share byl úspěšně smazán.', 'success');
     } elseif (!empty($values->id) && $values->export) {
         $this->share->find($values->id)->update(array('var' => $values->username, 'var2' => $values->password));
         $this->flashMessage('FTP share byl úspěšně upraven.', 'success');
     }
     //$this->share->exportNFS();
     $this->redirect('Slozky:');
 }
Exemplo n.º 2
0
 public function renderAuthFtp()
 {
     if ($this->httpRequest->getMethod() != "POST") {
         $this->error('Neplatná metoda.', 403);
     }
     $this->httpResponse->setContentType('text/plain', 'UTF-8');
     $username = $this->httpRequest->getPost('username', '');
     $password = $this->httpRequest->getPost('password', '');
     $s = $this->share->findOneBy(array('var' => $username, 'var2' => $password));
     $out = array();
     if (!$s) {
         $out[] = 'auth_ok:0';
     } else {
         $out[] = 'auth_ok:1';
         $out[] = 'uid:' . Model\Share::shareuid;
         $out[] = 'gid:' . Model\Share::sharegid;
         $out[] = 'dir:' . Model\Share::dataBaseUrl . $s->folder->name . '/';
     }
     $out[] = 'end';
     $this->send($out);
 }