Detect Post Type when publish_post is ran

publish_post will give you a second parameter if you ask for it. Notice the fourth parameter of the add_action call. That is your post object.

function run_on_publish_wpse_100421( $postid, $post ) { 
  if ('news' == $post->post_type) 
    // your code
  }
}
add_action('publish_post','run_on_publish_wpse_100421',1,2);

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