diff --git a/upload/ajax/posts.php b/upload/ajax/posts.php index 84c837bfa..67d72417f 100644 --- a/upload/ajax/posts.php +++ b/upload/ajax/posts.php @@ -59,10 +59,7 @@ switch($this->request['type']) post_delete($post_id); // Update user atom feed - require_once(INC_DIR .'functions_atom.php'); - $topic_id = (int) $this->request['topic_id']; - $topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster'); - update_user_feed($topic_poster, get_username($topic_poster)); + update_atom((int) $this->request['topic_id']); $this->response['hide'] = true; $this->response['post_id'] = $post_id; @@ -166,10 +163,7 @@ switch($this->request['type']) else $this->ajax_die($lang['EMPTY_MESSAGE']); // Update user atom feed - require_once(INC_DIR .'functions_atom.php'); - $topic_id = (int) $this->request['topic_id']; - $topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster'); - update_user_feed($topic_poster, get_username($topic_poster)); + update_atom((int) $this->request['topic_id']); $this->response['html'] = bbcode2html($text); } @@ -323,10 +317,7 @@ switch($this->request['type']) } // Update user atom feed - require_once(INC_DIR .'functions_atom.php'); - $topic_id = (int) $this->request['topic_id']; - $topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster'); - update_user_feed($topic_poster, get_username($topic_poster)); + update_atom((int) $this->request['topic_id']); $this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id"); break; diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 6e39e3a55..c83a7fb0f 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -2836,4 +2836,13 @@ function is_gold ($type) } return $is_gold; +} + +function update_atom ($topic_id) +{ + require_once(INC_DIR .'functions_atom.php'); + + // Update user atom feed + $topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster'); + update_user_feed($topic_poster, get_username($topic_poster)); } \ No newline at end of file diff --git a/upload/posting.php b/upload/posting.php index 69f277abd..a67293946 100644 --- a/upload/posting.php +++ b/upload/posting.php @@ -445,9 +445,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts ) } // Update user atom feed - require_once(INC_DIR .'functions_atom.php'); - $topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster'); - update_user_feed($topic_poster, get_username($topic_poster)); + update_atom($topic_id); if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED) {