What exactly happen after that chown?
All files are woned by the wrong user. In a jail, several files have to be owned by the root user and not the jailed shell user and that chown command changed all files to the shell user which destroyed the jail.
The fix will most likely be to add the following code where the two commented out chown lines are:
exec("chown -R ".escapeshellcmd($this->data['new']['puser']).":".escapeshellcmd($this->data['new']['pgroup'])." ".$usrdir.'/home/'.escapeshellcmd($this->data['new']['puser']).'/.ssh');