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);
// 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;

View file

@ -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));
}

View file

@ -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)
{