switch to use of $CFG->tempdir

Hi,

It would be preferable that all uses of the $CFG->dataroot.'/temp/' is replaced with calls to $CFG->tempdir. This is because on a local machine, $CFG->tempdir gets set to $CFG->dataroot.'/temp/', automatically but on our infrastructure, it can be somewhere different like a tmpfs.

With thanks. 

-Corey