// If the posting user is logged in, increment his/her post count if (!$pun_user['is_guest']) { if ($pun_user['num_posts'] == 0) { } $low_prio = $db_type == 'mysql' ? 'LOW_PRIORITY ' : ''; $db->query('UPDATE ' . $low_prio . $db->prefix . 'users SET num_posts=num_posts+1, last_post=' . $now . ' WHERE id=' . $pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error()); } // Redirect to "symfony app" after comment has been posted if ($is_comment) { $doc_param = get_doc_param($cur_posting['subject'] ? $cur_posting['subject'] : $subject); // clear symfony cache for the corresponding docs view, diff, history.. - in order to have number of comments properly displayed) c2cTools::clearCommentCache($doc_param[0], $doc_param[1]); // if this is the first comment on an outing or an image, we should send notifications to concerned people // and subscribe them to topic if ($fid) { $users = c2cTools::getUsersToNotify($doc_param[0]); if (!empty($users)) { // subscribe users to topic $values = array(); foreach ($users as $user) { $values[] = '(\'' . $user . "', '{$new_tid}')"; } $db->query('INSERT INTO ' . $db->prefix . 'subscriptions (user_id, topic_id) VALUES ' . implode(', ', $values)) or error('Unable to add subscription', __FILE__, __LINE__, $db->error()); // TODO maybe just continue silently if subscription fails? // send mails to concerned users require PUN_ROOT . 'include/email.php'; $result = $db->query('SELECT id, language, email FROM ' . $db->prefix . 'users WHERE id IN (' . implode(', ', $users) . ')') or error('Unable to fetch user languages', __FILE__, __LINE__, $db->error()); // TODO idem if ($db->num_rows($result) != count($users)) { message($lang_common['Bad request']); }