Firstly, I'm replacing all use of old-style global variables like
$HTTY_REFERER with their new-style equivalent $_SERVER["HTTP_REFERER"]
Also using $_POST instead $HTTP_POST_VARS etc
Secondly, if gdversion == 0 (ie GD is not installed) then:
- users are not even allowed to upload new images
- graphs now just print a message instead of failing.
this allows Moodle to still be used even if GD is not present
I've changed htmlentities to htmlspecialchars in this file, to fix
bugs with editing multibyte languages (ie Japanese). Please be
cautious and let me know if this causes any problems when editing
your language (it shouldn't, but I don't want to spoil your day!)