/**
  * Save admin settings.
  * @return string message
  */
 function save_admin_settings()
 {
     if (!array_var($_REQUEST, 'dir') || !array_var($_REQUEST, 'user') || !array_var($_REQUEST, 'server') || !array_var($_REQUEST, 'server_location')) {
         die(lang('Please fill in all the connection parameters'));
     }
     try {
         $save_data["gitoliteuser"] = array_var($_REQUEST, 'user');
         $save_data["gitoliteserveradd"] = array_var($_REQUEST, 'server');
         $save_data["gitoliteadminpath"] = array_var($_REQUEST, 'dir');
         $save_data["git_server_location"] = array_var($_REQUEST, 'server_location');
         DB::beginWork('Save admin settings @ ' . __CLASS__);
         $setting_exists = GitoliteAdmin::setting_exists();
         if ($setting_exists['cnt_settings'] == 0) {
             $settings_add = GitoliteAdmin::insert_settings($save_data, $this->logged_user->getId());
             if (!$settings_add) {
                 die("Problem occured while saving data, please try again.");
             }
         } else {
             $settings_update = GitoliteAdmin::update_settings($save_data, $this->logged_user->getId());
         }
         DB::commit('Admin Settings Saved @ ' . __CLASS__);
         $scan_pub_keys = $this->parse_user_keys();
         $scan_repos = $this->parse_repos();
         if (count($scan_pub_keys) == 0 && count($scan_repos) == 0) {
             die("nomap");
         } else {
             die("map");
         }
     } catch (Exception $e) {
         DB::rollback('Save admin settings @ ' . __CLASS__);
         die("Problem occured while saving data, please try again.");
     }
 }