Fix flattenDocument() to return values.

As taken from GitHub, flattenDocument() returns a data structure where the values are blank.  See Islandora-Dev message https://groups.google.com/d/topic/islandora-dev/A_ajiI6stnA/discussion for details.
Add check for writing temp files.

If $this->cookieFile = tempnam(sys_get_temp_dir(), 'curlcookie'); fails,
the problem isn't seen until saveCookiesToSession() when
$this->cookieFile is a boolean null instead of a file name.  This
adds a check to createCookieFile() to make sure the cookie file
in the temporary directory can be created.
Merge remote-tracking branch 'origin/1.x' into 1.x

Conflicts:
	FedoraApiSerializer.php