$db->sql_query($sql); $reply_id = $db->sql_nextid(); $blog_search->index('add', $blog_id, $reply_id, $message_parser->message, $reply_subject, $user->data['user_id']); // update the URLS to include the new reply_id generate_blog_urls(); $blog_attachment->update_attachment_data(false, $reply_id); blog_plugins::plugin_do_arg('reply_add_after_sql', $reply_id); // Handle the subscriptions add_blog_subscriptions($blog_id, 'subscription_'); handle_blog_cache('add_reply', $user_id); // update the reply count for the blog if ($sql_data['reply_approved']) { $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count + 1, blog_real_reply_count = blog_real_reply_count + 1 WHERE blog_id = ' . intval($blog_id); $db->sql_query($sql); set_config('num_blog_replies', ++$config['num_blog_replies'], true); handle_subscription('new_reply', censor_text($reply_subject), 0, $blog_id, $reply_id); } else { $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_real_reply_count = blog_real_reply_count + 1 WHERE blog_id = ' . intval($blog_id); $db->sql_query($sql); inform_approve_report('reply_approve', $reply_id); } $message = (!$sql_data['reply_approved'] ? $user->lang['REPLY_NEED_APPROVE'] : $user->lang['REPLY_SUBMIT_SUCCESS']) . '<br /><br />'; $message .= '<a href="' . $blog_urls['view_reply'] . '">' . $user->lang['VIEW_REPLY'] . '</a><br />'; $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />'; if ($user_id == $user->data['user_id']) { $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>'); } else { $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />'; $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>'); } if (!$sql_data['reply_approved']) {
$category_list = get_blog_categories('category_id'); foreach ($category_ary as $i => $cat_id) { if (!isset($category_list[$cat_id])) { unset($category_ary[$i]); } } put_blogs_in_cats($blog_id, $category_ary, $auth->acl_get('u_blognoapprove') ? true : false); } // regenerate the urls to include the blog_id generate_blog_urls(); blog_plugins::plugin_do_arg('blog_add_after_sql', $blog_id); handle_blog_cache('new_blog', $user->data['user_id']); if ($sql_data['blog_approved']) { // Update the blog_count for the user $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count + 1 WHERE user_id = ' . $user->data['user_id']; $db->sql_query($sql); set_config('num_blogs', ++$config['num_blogs'], true); handle_subscription('new_blog', censor_text($blog_subject), $user->data['user_id'], $blog_id); } else { inform_approve_report('blog_approve', $blog_id); } $message = !$sql_data['blog_approved'] ? $user->lang['BLOG_NEED_APPROVE'] : $user->lang['BLOG_SUBMIT_SUCCESS']; $message .= '<br /><br /><a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />'; $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>'); if (!$sql_data['blog_approved']) { blog_meta_refresh(3, $blog_urls['view_user_self']); } else { blog_meta_refresh(3, $blog_urls['view_blog']); } trigger_error($message); }
WHERE blog_id = ' . intval($blog_id); $db->sql_query($sql); // Update the blog_count for the user $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count + 1 WHERE user_id = ' . intval($user_id); $db->sql_query($sql); set_config('num_blogs', ++$config['num_blogs'], true); // Update the blog_count for all the categories it is in. $category_ids = array(); $sql = 'SELECT category_id FROM ' . BLOGS_IN_CATEGORIES_TABLE . ' WHERE blog_id = ' . intval($blog_id); $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $category_ids[] = $row['category_id']; } put_blogs_in_cats($blog_id, $category_ids, true, 'approve'); handle_blog_cache('approve_blog', $user_id); handle_subscription('new_blog', censor_text(blog_data::$blog[$blog_id]['blog_subject'])); blog_meta_refresh(3, $blog_urls['view_blog']); $message = $user->lang['APPROVE_BLOG_SUCCESS']; $message .= '<br /><br /><a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />'; if ($user_id == $user->data['user_id']) { $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>'); } else { $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />'; $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>'); } trigger_error($message); } else { confirm_box(false, 'APPROVE_BLOG'); } } else { $message = $user->lang['BLOG_ALREADY_APPROVED'];
page_header($user->lang['APPROVE_REPLY']); blog_plugins::plugin_do('reply_approve'); // Generate the breadcrumbs generate_blog_breadcrumbs($user->lang['APPROVE_REPLY']); if (blog_data::$reply[$reply_id]['reply_approved'] == 0) { if (confirm_box(true)) { blog_plugins::plugin_do('reply_approve_confirm'); $sql = 'UPDATE ' . BLOGS_REPLY_TABLE . ' SET reply_approved = 1 WHERE reply_id = ' . intval($reply_id); $db->sql_query($sql); // update the reply count for the blog $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count + 1 WHERE blog_id = ' . intval($blog_id); $db->sql_query($sql); set_config('num_blog_replies', ++$config['num_blog_replies'], true); handle_subscription('new_reply', censor_text(blog_data::$reply[$reply_id]['reply_subject']), 0, 0, $reply_id); handle_blog_cache('approve_reply', $user_id); blog_meta_refresh(3, $blog_urls['view_reply']); $message = $user->lang['APPROVE_REPLY_SUCCESS'] . '<br /><br />'; $message .= '<a href="' . $blog_urls['view_reply'] . '">' . $user->lang['VIEW_REPLY'] . '</a><br />'; $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />'; if ($user_id == $user->data['user_id']) { $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>'); } else { $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />'; $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>'); } trigger_error($message); } else { confirm_box(false, 'APPROVE_REPLY'); }