- Merged some foreign fixes
| | |
| | | 'errmsg'=> 'email_error_empty'), |
| | | ), |
| | | 'validators' => array ( 0 => array ( 'type' => 'REGEX', |
| | | 'regex' => '/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}$/i', |
| | | 'regex' => '/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i', |
| | | 'errmsg'=> 'email_error_isemail'), |
| | | ), |
| | | 'default' => '', |
| | |
| | | } else { |
| | | $app->tpl->setVar("edit_disabled", 0); |
| | | } |
| | | |
| | | if($this->dataRecord['chroot'] == 'jailkit'){ |
| | | $app->tpl->setVar("is_jailkit", true); |
| | | } else { |
| | | $app->tpl->setVar("is_jailkit", false); |
| | | } |
| | | |
| | | parent::onShowEnd(); |
| | | } |
| | |
| | | $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $this->dataRecord["parent_domain_id"]); |
| | | |
| | | $server_id = $app->functions->intval($web["server_id"]); |
| | | $dir = $web["document_root"]; |
| | | if($this->dataRecord['chroot'] == 'jailkit'){ |
| | | $dir = $app->db->quote($web["document_root"]); |
| | | } else { |
| | | $dir = $app->db->quote($web["document_root"].'/home/'.$this->dataRecord['username']); |
| | | } |
| | | $uid = $web["system_user"]; |
| | | $gid = $web["system_group"]; |
| | | |
| | |
| | | function onAfterUpdate() { |
| | | global $app, $conf; |
| | | |
| | | if(isset($this->dataRecord['chroot'])){ |
| | | $shell_user = $app->db->queryOneRecord("SELECT * FROM shell_user WHERE shell_user_id = ".$this->id); |
| | | $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); |
| | | $dir = $shell_user['dir']; |
| | | if($this->dataRecord['chroot'] == 'jailkit'){ |
| | | $dir = $app->db->quote($web["document_root"]); |
| | | } else { |
| | | if($this->oldDataRecord['chroot'] == 'jailkit') $dir = $app->db->quote($web["document_root"].'/home/'.$this->dataRecord['username']); |
| | | } |
| | | |
| | | if($dir != $shell_user['dir']) $app->db->query("UPDATE shell_user SET dir = '$dir' WHERE shell_user_id = ".$this->id); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | </div> |
| | | <p><tmpl_var name="list_desc_txt"></p> |
| | | |
| | | |
| | | |
| | | <div class="form-group"> |
| | | <label for="puser" class="col-sm-3 control-label">{tmpl_var name='puser_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="puser" id="puser" value="{tmpl_var name='puser'}" class="form-control" /></div></div> |
| | | <div class="form-group"> |
| | | <label for="pgroup" class="col-sm-3 control-label">{tmpl_var name='pgroup_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="pgroup" id="pgroup" value="{tmpl_var name='pgroup'}" class="form-control" /></div></div> |
| | | <div class="form-group"> |
| | | <label for="shell" class="col-sm-3 control-label">{tmpl_var name='shell_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="shell" id="shell" value="{tmpl_var name='shell'}" class="form-control" /></div></div> |
| | | <div class="form-group"> |
| | | <label for="dir" class="col-sm-3 control-label">{tmpl_var name='dir_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="dir" id="dir" value="{tmpl_var name='dir'}" class="form-control" /></div></div> |
| | | |
| | | <div class="form-group"> |
| | | <label for="puser" class="col-sm-3 control-label">{tmpl_var name='puser_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="puser" id="puser" value="{tmpl_var name='puser'}" class="form-control" /></div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label for="pgroup" class="col-sm-3 control-label">{tmpl_var name='pgroup_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="pgroup" id="pgroup" value="{tmpl_var name='pgroup'}" class="form-control" /></div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label for="shell" class="col-sm-3 control-label">{tmpl_var name='shell_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="shell" id="shell" value="{tmpl_var name='shell'}" class="form-control" /></div> |
| | | </div> |
| | | <tmpl_if name="is_jailkit"> |
| | | <input type="hidden" name="dir" id="dir" value="{tmpl_var name='dir'}"> |
| | | </tmpl_else> |
| | | <div class="form-group"> |
| | | <label for="dir" class="col-sm-3 control-label">{tmpl_var name='dir_txt'}</label> |
| | | <div class="col-sm-9"><input type="text" name="dir" id="dir" value="{tmpl_var name='dir'}" class="form-control" /></div> |
| | | </div> |
| | | </tmpl_if> |
| | | |
| | | |
| | | <input type="hidden" name="id" value="{tmpl_var name='id'}"> |
| | | |
| | |
| | | } else { |
| | | |
| | | if($islocation){ |
| | | if(strpos($l, '{') !== false){ |
| | | $openingbracketpos = strrpos($l, '{'); |
| | | if($openingbracketpos !== false){ |
| | | $level += 1; |
| | | } |
| | | if(strpos($l, '}') !== false && $level > 0){ |
| | | $closingbracketpos = strrpos($l, '}'); |
| | | if($closingbracketpos !== false && $level > 0 && $closingbracketpos >= intval($openingbracketpos)){ |
| | | $level -= 1; |
| | | $locations[$location]['location'] .= $lines[$i]."\n"; |
| | | } elseif(strpos($l, '}') !== false && $level == 0){ |
| | | } elseif($closingbracketpos !== false && $level == 0 && $closingbracketpos >= intval($openingbracketpos)){ |
| | | $islocation = false; |
| | | } else { |
| | | $locations[$location]['location'] .= $lines[$i]."\n"; |
| | |
| | | exec($command); |
| | | $app->log("Executed command: ".$command, LOGLEVEL_DEBUG); |
| | | $app->log("Added shelluser: ".$data['new']['username'], LOGLEVEL_DEBUG); |
| | | |
| | | $app->system->chown(escapeshellcmd($data['new']['dir']),escapeshellcmd($data['new']['username'])); |
| | | $app->system->chgrp(escapeshellcmd($data['new']['dir']),escapeshellcmd($data['new']['pgroup'])); |
| | | |
| | | |
| | | // call the ssh-rsa update function |
| | | $app->uses("getconf"); |
| | |
| | | } |
| | | }*/ |
| | | |
| | | $app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh'); |
| | | $shell = '/usr/sbin/jk_chrootsh'; |
| | | if($this->data['new']['active'] != 'y') $shell = '/bin/false'; |
| | | |
| | | $app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, $shell); |
| | | $app->system->usermod($this->data['new']['puser'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh'); |
| | | |
| | | $this->app->log("Added jailkit user to chroot with command: ".$command, LOGLEVEL_DEBUG); |