summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authormichael pereira2011-05-11 15:01:16 +0200
committermichael pereira2011-05-11 15:01:16 +0200
commite7095bdcf161350e06cdd562c39632d602f02722 (patch)
tree2be9abbb8f859ecb9b64c5c384053e01c40376a5 /application
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-e7095bdcf161350e06cdd562c39632d602f02722.tar.gz
pbs2-e7095bdcf161350e06cdd562c39632d602f02722.tar.xz
pbs2-e7095bdcf161350e06cdd562c39632d602f02722.zip
ViewScript für config gefixt
Diffstat (limited to 'application')
-rw-r--r--application/controllers/ResourceController.php39
-rw-r--r--application/views/scripts/resource/getconfig.phtml31
2 files changed, 35 insertions, 35 deletions
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index 6ae3aed..e67e008 100644
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -368,9 +368,7 @@ class ResourceController extends Zend_Controller_Action
}
public function getconfigAction()
- {
- $this->initView();
-
+ {
$bootmenuentryID = $this->thisSession->getBootmenuentryID();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bmm = new Application_Model_BootMenuEntriesMapper();
@@ -420,47 +418,52 @@ class ResourceController extends Zend_Controller_Action
$test[] = $user->getLogin();
}
+ $configView = new Zend_View();
$f = fopen("$tmp_conf/initramfs/postinit.local", "a");
foreach($bootosuser as $user){
if($user->getLogin() == '%username%'){
- $this->view->loginname = $username;
+ $configView->loginname = $username;
}else{
- $this->view->loginname = $user->getLogin();
+ $configView->loginname = $user->getLogin();
}
if($user->getPassword() == '%password%'){
- $this->view->password = $userpassword;
+ $configView->password = $userpassword;
}else{
- $this->view->password = $user->getPassword();
+ $configView->password = $user->getPassword();
}
if($user->getHometypeID() == 2){
- $this->view->homepath = $user->getHomepath();
+ $configView->homepath = $user->getHomepath();
}elseif($user->getHometypeID() == 1){
- $this->view->homepath = "/media/openslx-stick/home/".$this->view->loginname;
+ $configView->homepath = "/media/openslx-stick/home/".$configView->loginname;
}else{
- $this->view->homepath = "/home/".$this->view->loginname;
+ $configView->homepath = "/home/".$configView->loginname;
}
- if($this->view->loginname != '' && $this->view->password != ''){
+ if($configView->loginname != '' && $configView->password != ''){
if($user->getHometypeID() == 1){
- $this->view->usb = true;
+ $configView->usb = true;
}
else{
- $this->view->usb = false;
+ $configView->usb = false;
if($anzUsers <= 2 && $user->getLogin() == 'kiosk' && in_array('%username%',$test) && $this->thisSession->getMembershipID() == null)
- $this->view->autologin = true;
+ $configView->autologin = true;
elseif($anzUsers <= 2 && $user->getLogin() == '%username%' && $this->thisSession->getMembershipID() != null)
- $this->view->autologin = true;
+ $configView->autologin = true;
else
- $this->view->autologin = false;
+ $configView->autologin = false;
}
- $this->render();
- fputs($f, $this->view->script);
+
+
+ $configView->addScriptPath(APPLICATION_PATH.'/views/scripts/resource/');
+ $config = $configView->render('getconfig.phtml');
+
+ fputs($f, $config);
}
}
diff --git a/application/views/scripts/resource/getconfig.phtml b/application/views/scripts/resource/getconfig.phtml
index 0e34b6e..bb5241b 100644
--- a/application/views/scripts/resource/getconfig.phtml
+++ b/application/views/scripts/resource/getconfig.phtml
@@ -1,7 +1,4 @@
-<?php
- if($this->usb == true){
- $this->script ="
-
+<?if ($this->usb): ?>
modprobe usb_storage
echo -n 'Mounting OpenSLX-Stick:';
while [ ! -e /dev/sdb1 ] do
@@ -12,21 +9,21 @@ done
mkdir -p /mnt/media/openslx-stick
mount /dev/sdb1 /mnt/media/openslx-stick
if [ -d /mnt/media/openslx-stick/boot ]; then
- if [ ! -d '/mnt/media/openslx-stick/home/$this->loginname' ]; then
+ if [ ! -d '/mnt/media/openslx-stick/home/<?=$this->loginname?>' ]; then
mkdir -p '/mnt/media/openslx-stick/home/'
- chroot /mnt useradd -m -d '$this->homepath' -s /bin/bash -p '$this->password' '$this->loginname'
+ chroot /mnt useradd -m -d '<?=$this->homepath?>' -s /bin/bash -p '<?=$this->password?>' '<?=$this->loginname?>'
else
- chroot /mnt useradd -d '$this->homepath' -s '/bin/bash' -p '$this->password' '$this->loginname'
+ chroot /mnt useradd -d '<?=$this->homepath?>' -s '/bin/bash' -p '<?=$this->password?>' '<?=$this->loginname?>'
fi
else
- chroot /mnt useradd -d '/home/$this->loginname' -m -s '/bin/bash' -p '$this->password' '$this->loginname'
-fi \n";
+ chroot /mnt useradd -d '/home/<?=$this->loginname?>' -m -s '/bin/bash' -p '<?=$this->password?>' '<?=$this->loginname?>'
+fi
- }else{
- $this->script = "chroot /mnt useradd -d '$this->homepath' -m -s /bin/bash -p '$this->password' '$this->loginname' \n";
- if($this->autologin == true){
- $this->script .= "chroot /mnt sed -e \"s/AutoLoginEnable=.*/AutoLoginEnable=true/g;\" /etc/kde4/kdm/kdmrc > /tmp/tmpkdmrc
- && sed 21iAutoLoginUser='$this->loginname' /tmp/tmpkdmrc > /mnt/etc/kde4/kdm/kdmrc
- && rm /tmp/tmpkdmrc \n";
- }
- } \ No newline at end of file
+<? else: ?>
+ chroot /mnt useradd -d '<?=$this->homepath?>' -m -s /bin/bash -p '<?=$this->password?>' '<?=$this->loginname?>'
+ <?php if($this->autologin):?>
+ chroot /mnt sed -e \"s/AutoLoginEnable=.*/AutoLoginEnable=true/g;\" /etc/kde4/kdm/kdmrc > /tmp/tmpkdmrc
+ && sed 21iAutoLoginUser='<?=$this->loginname?>' /tmp/tmpkdmrc > /mnt/etc/kde4/kdm/kdmrc
+ && rm /tmp/tmpkdmrc
+ <?php endif;?>
+<? endif; ?> \ No newline at end of file