Function update_atom

Переходим на использование функции для минимизации кода.
This commit is contained in:
Exile 2014-08-13 23:15:19 +04:00
commit 1969c6c57e
3 changed files with 13 additions and 15 deletions

View file

@ -59,10 +59,7 @@ switch($this->request['type'])
post_delete($post_id); post_delete($post_id);
// Update user atom feed // Update user atom feed
require_once(INC_DIR .'functions_atom.php'); update_atom((int) $this->request['topic_id']);
$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));
$this->response['hide'] = true; $this->response['hide'] = true;
$this->response['post_id'] = $post_id; $this->response['post_id'] = $post_id;
@ -166,10 +163,7 @@ switch($this->request['type'])
else $this->ajax_die($lang['EMPTY_MESSAGE']); else $this->ajax_die($lang['EMPTY_MESSAGE']);
// Update user atom feed // Update user atom feed
require_once(INC_DIR .'functions_atom.php'); update_atom((int) $this->request['topic_id']);
$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));
$this->response['html'] = bbcode2html($text); $this->response['html'] = bbcode2html($text);
} }
@ -323,10 +317,7 @@ switch($this->request['type'])
} }
// Update user atom feed // Update user atom feed
require_once(INC_DIR .'functions_atom.php'); update_atom((int) $this->request['topic_id']);
$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));
$this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id"); $this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id");
break; break;

View file

@ -2837,3 +2837,12 @@ function is_gold ($type)
return $is_gold; 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));
}

View file

@ -445,9 +445,7 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
} }
// Update user atom feed // Update user atom feed
require_once(INC_DIR .'functions_atom.php'); update_atom($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));
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED) if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED)
{ {