diff options
| -rw-r--r-- | application/controllers/ResourceController.php | 25 | ||||
| -rw-r--r-- | application/models/BootOsUserMapper.php | 2 | ||||
| -rw-r--r-- | application/modules/user/controllers/ConfigController.php | 4 | ||||
| -rw-r--r-- | application/modules/user/forms/Bootos.php | 1 | ||||
| -rw-r--r-- | application/modules/user/forms/Preboot.php | 3 | ||||
| -rw-r--r-- | application/modules/user/views/scripts/config/index.phtml | 18 |
6 files changed, 26 insertions, 27 deletions
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index d48867a..1c28d12 100644 --- a/application/controllers/ResourceController.php +++ b/application/controllers/ResourceController.php @@ -59,7 +59,7 @@ class ResourceController extends Zend_Controller_Action $session->setBootosID($bootmenuentry->getBootosID()) ->setBootmenuentryID($bootmenuentry->getID()) ->setTime(time()) - ->setMembershipID($bootmenuMapper->find($bootmenuentry->getBootmenuID())->getMembershipID()) + ->setMembershipID('1') ->setIp($_SERVER['REMOTE_ADDR']) ->setAlphasessionID('0'); @@ -389,15 +389,17 @@ class ResourceController extends Zend_Controller_Action chdir("../resources/bootos/$bootosID/config/"); passthru( "cat default.tgz"); }else{ - $bootosuserMapper = new Application_Model_BootOsUserMapper(); $bootosuser = $bootosuserMapper->findBy(array('configID' => $configID)); $hash = md5(microtime(1)); $tmp_conf = "../resources/config/$hash"; mkdir($tmp_conf ,0777, true); - exec("tar -C $tmp_conf -xvf ../resources/bootos/$bootosID/config/default.tgz"); + exec("tar -C $tmp_conf -xvf ../resources/bootos/$bootosID/config/default.tgz",$restul); + //exec("cp ../resources/config/loginfiles/* $path_userconf/rootfs/etc/"); + $username = ''; + $userpassword = ''; if($this->thisSession->getMembershipID() != null){ $person = new Application_Model_Person(); @@ -409,15 +411,16 @@ class ResourceController extends Zend_Controller_Action $username = preg_replace("!\s!","",$username); $userpassword = $person->getLoginPassword(); } - - foreach($bootosuser as $user){ - if($user->getLogin == '%username%'){ + + foreach($bootosuser as $user){ + + if($user->getLogin() == '%username%'){ $loginname = $username; }else{ $loginname = $user->getLogin(); } - if($user->getPassword == '%password%'){ + if($user->getPassword() == '%password%'){ $password = $userpassword; }else{ $password = $user->getPassword(); @@ -431,9 +434,11 @@ class ResourceController extends Zend_Controller_Action $homepath = "/home/$loginname"; } - exec("echo 'chroot /mnt useradd -d ".$homepath." -m -p '".$password."'".$loginname."' >> $tmp_conf/initramfs/postinit.local"); - + if($loginname != '' && $password != '') + exec("echo 'chroot /mnt useradd -d ".$homepath." -m -p \"".$password."\" ".$loginname."' >> $tmp_conf/initramfs/postinit.local",$restul); + } + // create the gzipped tarfile. chdir($tmp_conf); passthru( "tar cz *"); @@ -497,7 +502,7 @@ class ResourceController extends Zend_Controller_Action }else{ $result = "alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/c/".$this->_request->getParam('alpha')."/default.tgz ".$bme->getKclappend(); } - + $result = trim($result); header("Content-Length: ".(strlen($result))); echo $result; diff --git a/application/models/BootOsUserMapper.php b/application/models/BootOsUserMapper.php index a50fd02..f93cd3f 100644 --- a/application/models/BootOsUserMapper.php +++ b/application/models/BootOsUserMapper.php @@ -88,7 +88,7 @@ class Application_Model_BootOsUserMapper unset($data['bootosuserID']); return $this->getDbTable()->insert($data); } else { - $this->getDbTable()->update($data, array('bootosID = ?' => $id)); + $this->getDbTable()->update($data, array('bootosuserID = ?' => $id)); } } diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php index 6acb697..eca5d54 100644 --- a/application/modules/user/controllers/ConfigController.php +++ b/application/modules/user/controllers/ConfigController.php @@ -360,7 +360,9 @@ class user_ConfigController extends Zend_Controller_Action if(!Pbs_Acl::checkRight('ce')) $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden'); } - + + $bootosuser->setID($bootosuserID); + $bootosuser->setConfigID($configID); $bootosuser->setHomepath(str_replace("%login-name%", $bootosuser->getLogin(), $bootosuser->getHomepath())); if($bootosuser->getPassword() != '%password%') $bootosuser->setPassword(crypt($bootosuser->getPassword(), '$6$'.randomString(8).'$')); diff --git a/application/modules/user/forms/Bootos.php b/application/modules/user/forms/Bootos.php index 5e20a8a..432f0c7 100644 --- a/application/modules/user/forms/Bootos.php +++ b/application/modules/user/forms/Bootos.php @@ -37,6 +37,7 @@ class user_Form_Bootos extends Zend_Form { $this->setName("BootOsCreate"); $this->setMethod('post'); + $this->setEnctype("multipart/form-data"); if (!Pbs_Acl::checkRight('boe') && $this->action == 'editbootos') $meta = true; diff --git a/application/modules/user/forms/Preboot.php b/application/modules/user/forms/Preboot.php index 54dc216..f1a609f 100644 --- a/application/modules/user/forms/Preboot.php +++ b/application/modules/user/forms/Preboot.php @@ -27,7 +27,8 @@ class user_Form_Preboot extends Zend_Form { $this->setName($this->action); $this->setMethod('post'); - + $this->setEnctype("multipart/form-data"); + if (!Pbs_Acl::checkRight('pre') && $this->action == 'editpreboot') $meta = true; else diff --git a/application/modules/user/views/scripts/config/index.phtml b/application/modules/user/views/scripts/config/index.phtml index 37f5a9f..8ca5875 100644 --- a/application/modules/user/views/scripts/config/index.phtml +++ b/application/modules/user/views/scripts/config/index.phtml @@ -34,7 +34,7 @@ <div class='element'> <div class='number'> <div class='smallnumber'>BootOs</div> - <?php echo $k ?> + <?php echo $k+1 ?> </div> <div class='content'> <div class='actions'> @@ -59,7 +59,7 @@ <?php ?> <div class='title'><?php echo $this->escape($bootos->getTitle()); ?></div> <div class='subtitle'><?php echo $this->escape($bootos->getGroupID()); ?> - <?php echo $this->escape($bootos->getDescription()); ?></div> - <div class='details'> + <div class='details dispnone'> <?php if(count($this->configlist[$bootos->getID()])==0) echo "There are no Config's to display." ?> <?php foreach ($this->configlist[$bootos->getID()] as $k => $config): ?> @@ -110,7 +110,7 @@ </div> <div class='title'><?php echo $this->escape($config->getTitle()); ?></div> <div class='subtitle'><?php echo $this->escape($config->getDescription()) ?></div> - <div class='details'> + <div class='details dispnone'> <?php if(Pbs_Acl::checkRight('csai')): ?> <label>ConfigID</label> <div class='item'><?php echo $this->escape($config->getID()); ?></div> @@ -135,14 +135,4 @@ <?php echo $this->pagination; ?> -<script type="text/javascript"> -$(document).ready(function(){ - if($('.element').find('.dispnone').length >= 1){ - $(this).find('.title').css('cursor','pointer'); - - $('.title').click(function(){ - $(this).siblings('.dispnone').toggle(); - }); - } -}); -</script> + |
