refactor server_plugins.php:

1. change HTML mixture to php
2. change long code to functions
3. move functions to libraries/server_plugins.lib.php