static function filename($profile, $basename, $mimetype)
{
require_once 'MIME/Type/Extension.php';
+
+ // We have to temporarily disable auto handling of PEAR errors...
+ PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
+
$mte = new MIME_Type_Extension();
- try {
- $ext = $mte->getExtension($mimetype);
- } catch ( Exception $e) {
+ $ext = $mte->getExtension($mimetype);
+ if (PEAR::isError($ext)) {
$ext = strtolower(preg_replace('/\W/', '', $mimetype));
}
+
+ // Restore error handling.
+ PEAR::staticPopErrorHandling();
+
$nickname = $profile->nickname;
$datestamp = strftime('%Y%m%dT%H%M%S', time());
$random = strtolower(common_confirmation_code(32));
static function getUploadedFileType($f, $originalFilename=false) {
require_once 'MIME/Type.php';
require_once 'MIME/Type/Extension.php';
+
+ // We have to disable auto handling of PEAR errors
+ PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
$mte = new MIME_Type_Extension();
$cmd = &PEAR::getStaticProperty('MIME_Type', 'fileCmd');
}
}
if ($supported === true || in_array($filetype, $supported)) {
+ // Restore PEAR error handlers for our DB code...
+ PEAR::staticPopErrorHandling();
return $filetype;
}
$media = MIME_Type::getMedia($filetype);
// TRANS: %s is the file type that was denied.
$hint = sprintf(_('"%s" is not a supported file type on this server.'), $filetype);
}
+ // Restore PEAR error handlers for our DB code...
+ PEAR::staticPopErrorHandling();
throw new ClientException($hint);
}