Restrict authors to seeing ONLY their media files

Not tested, but maybe you can just extend the $pagenow check?

Instead of …

if( 'upload.php' != $pagenow )

… try …

if( ! in_array( $pagenow, array ( 'upload.php', 'post-new.php', 'post.php' ) ) )

That should cover the post editor screens too.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)