diff --git a/server/lib/classes/file.inc.php b/server/lib/classes/file.inc.php index 0cfdf6f2eddcb62489b2c7af490679e261b93b65..d3117c36dcad9ce2750a7dd282228319807777f9 100644 --- a/server/lib/classes/file.inc.php +++ b/server/lib/classes/file.inc.php @@ -124,9 +124,11 @@ class file{ if(trim($line) != '') $new_lines[] = $line; } } - - $content = implode("\n", $new_lines); - + if(!empty($new_lines)){ + $content = implode("\n", $new_lines); + } else { + $content = ''; + } if($file){ $this->wf($input, $content); } else { diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index 2fc4f0dfc7cdc0b657825dbdfe51fbb299794b53..cb4684319781820e053864f4029661aa73066a8e 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -477,7 +477,11 @@ class shelluser_base_plugin { // Remove duplicate keys $existing_keys = @file($sshkeys, FILE_IGNORE_NEW_LINES); $new_keys = explode("\n", $userkey); - $final_keys_arr = @array_merge($existing_keys, $new_keys); + if(is_array($existing_keys)) { + $final_keys_arr = @array_merge($existing_keys, $new_keys); + } else { + $final_keys_arr = $new_keys; + } $new_final_keys_arr = array(); if(is_array($final_keys_arr) && !empty($final_keys_arr)){ foreach($final_keys_arr as $key => $val){ diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index dbc3d8041b22b72180cf49a9eb9a931f7454796c..1b2ff74db912b89960de3f74274ea5a1b90fbbb6 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -318,6 +318,8 @@ class shelluser_jailkit_plugin { $options = array('hardlink'); } elseif ($this->jailkit_config['jailkit_hardlinks'] == 'no') { $options = array(); + } else { + $options = array(); } } else { $options = array('allow_hardlink'); @@ -527,7 +529,11 @@ class shelluser_jailkit_plugin { // Remove duplicate keys $existing_keys = @file($sshkeys, FILE_IGNORE_NEW_LINES); $new_keys = explode("\n", $userkey); - $final_keys_arr = @array_merge($existing_keys, $new_keys); + if(is_array($existing_keys)) { + $final_keys_arr = @array_merge($existing_keys, $new_keys); + } else { + $final_keys_arr = $new_keys; + } $new_final_keys_arr = array(); if(is_array($final_keys_arr) && !empty($final_keys_arr)){ foreach($final_keys_arr as $key => $val){