diff options
| author | Simon Rettberg | 2016-04-28 21:31:15 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2016-04-28 21:31:15 +0200 |
| commit | 95db8e184b378534db0ac08d14ae8500ee5090c3 (patch) | |
| tree | f39cee8160ef4266e49dbe04d3e8fe6400ce2133 /modules/vmstore/module.inc.php | |
| parent | Merge branch 'master' into modularization (diff) | |
| download | slx-admin-95db8e184b378534db0ac08d14ae8500ee5090c3.tar.gz slx-admin-95db8e184b378534db0ac08d14ae8500ee5090c3.tar.xz slx-admin-95db8e184b378534db0ac08d14ae8500ee5090c3.zip | |
Implemented new menu, added logic for defining dependencies, move translation files around
Diffstat (limited to 'modules/vmstore/module.inc.php')
| -rw-r--r-- | modules/vmstore/module.inc.php | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/modules/vmstore/module.inc.php b/modules/vmstore/module.inc.php deleted file mode 100644 index 81f92ee3..00000000 --- a/modules/vmstore/module.inc.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -class Page_VmStore extends Page -{ - private $mountTask = false; - - protected function doPreprocess() - { - User::load(); - - if (!User::hasPermission('superadmin')) { - Message::addError('no-permission'); - Util::redirect('?do=Main'); - } - - $action = Request::post('action'); - - if ($action === 'setstore') { - $this->setStore(); - } - } - - protected function doRender() - { - $action = Request::post('action'); - if ($action === 'setstore' && !Taskmanager::isFailed($this->mountTask)) { - Render::addTemplate('mount', array( - 'task' => $this->mountTask['id'] - )); - return; - } - $vmstore = Property::getVmStoreConfig(); - if (isset($vmstore['storetype'])) { - $vmstore['pre-' . $vmstore['storetype']] = 'checked'; - } - Render::addTemplate('page-vmstore', $vmstore); - } - - private function setStore() - { - foreach (array('storetype', 'nfsaddr', 'cifsaddr', 'cifsuser', 'cifspasswd', 'cifsuserro', 'cifspasswdro') as $key) { - $vmstore[$key] = trim(Request::post($key, '')); - } - $storetype = $vmstore['storetype']; - if (!in_array($storetype, array('internal', 'nfs', 'cifs'))) { - Message::addError('value-invalid', 'type', $storetype); - Util::redirect('?do=VmStore'); - } - // Validate syntax of nfs/cifs - if ($storetype === 'nfs' && !preg_match('#^\S+:\S+$#is', $vmstore['nfsaddr'])) { - Message::addError('value-invalid', 'nfsaddr', $vmstore['nfsaddr']); - Util::redirect('?do=VmStore'); - } - $vmstore['cifsaddr'] = str_replace('\\', '/', $vmstore['cifsaddr']); - if ($storetype === 'cifs' && !preg_match('#^//\S+/.+$#is', $vmstore['cifsaddr'])) { - Message::addError('value-invalid', 'nfsaddr', $vmstore['nfsaddr']); - Util::redirect('?do=VmStore'); - } - $this->mountTask = Trigger::mount($vmstore); - TaskmanagerCallback::addCallback($this->mountTask, 'manualMount', $vmstore); - } - -}
\ No newline at end of file |
