From d5b319ba583a969dcfaf4f553b309c8fc378d14f Mon Sep 17 00:00:00 2001 From: michael pereira Date: Mon, 25 Apr 2011 13:08:07 +0200 Subject: config fix --- application/controllers/ResourceController.php | 22 ++++++++++++++-------- .../modules/user/views/scripts/config/index.phtml | 18 ++++-------------- 2 files changed, 18 insertions(+), 22 deletions(-) (limited to 'application') diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php index d48867a..fa3b214 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'); @@ -396,8 +396,11 @@ class ResourceController extends Zend_Controller_Action $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 +412,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 +435,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 *"); 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 @@