コード例 #1
0
ファイル: Filesystem.php プロジェクト: Mabahe/webinterface
 public function addMount($m = false)
 {
     if (!$m) {
         //Prüfen der Eingaben!
         $m = new Mount();
         $test1 = $m->setMountpoint(trim($_GET['mountpoint']));
         $test2 = $m->setPath(trim($_GET['path']));
         $test3 = $m->setType($_GET['type']);
         $test4 = $m->setOptions($_GET['options']);
     } else {
         $test1 = $test2 = $test3 = $test4 = true;
     }
     //only allowed in mnt and media to mount directories
     if (strpos($m->getPath(), '/mnt/') === 0 || strpos($m->getPath(), '/media/') === 0) {
         //richtiges Verzeichnis
         //Check ob Unterverzeichnis existiert
         if (!file_exists($m->getPath())) {
             $this->writeDynamicScript(array('mkdir -p "' . $m->getPath() . '"; chmod -R 777 "' . $m->getPath() . '"'));
             $this->view->message[] = _("Directory created: " . $m->getPath());
         }
     } else {
         $test2 = false;
         $this->view->message[] = _("Wrong Path: " . $m->getPath());
     }
     //Hinzufügen in FSTAB hinter ##USERMOUNT (Trennlinie für Usereigene Mounts)
     if ($test1 && $test2 && $test3 && $test4) {
         shell_exec("echo '" . $m->getMountpoint(true, true) . " " . $m->getPath() . " " . $m->getType() . " " . $m->getOptions() . "' >> " . $this->_fstabPath . "fstab");
         if ($this->reloadMount()) {
             $this->view->message[] = _("Mountpoint successfully added");
             return true;
         }
     }
     $this->view->message[] = _("Mountpoint NOT added! Please refer to the description below!");
     return false;
 }