Example #1
0
         update_forum($fid);
         if (!$pun_user['is_guest']) {
             mark_topic_read($new_tid, $fid, $now);
         }
     }
 }
 // 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
Example #2
0
} else {
    $result = $db->query('SELECT pf.forum_name AS parent_forum, f.parent_forum_id, t.subject, t.closed, t.num_replies, t.sticky, t.question, t.yes, t.no, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies FROM ' . $db->prefix . 'topics AS t INNER JOIN ' . $db->prefix . 'forums AS f ON f.id=t.forum_id LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $pun_user['g_id'] . ')  LEFT JOIN ' . $db->prefix . 'forums AS pf ON f.parent_forum_id=pf.id WHERE (fp.read_forum IS NULL OR fp.read_forum=1 OR fp.forum_id=1) AND t.id=' . $id . ' AND t.moved_to IS NULL') or error('Impossible de retrouver les informations de la discussion', __FILE__, __LINE__, $db->error());
}
if (!$db->num_rows($result)) {
    message($lang_common['Bad request']);
}
$cur_topic = $db->fetch_assoc($result);
// Sort out who the moderators are and if we are currently a moderator (or an admin)
list($is_admmod, $is_c2c_board) = get_is_admmod($cur_topic['forum_id'], $cur_topic['moderators'], $pun_user);
// c2c board topic
if (!$is_c2c_board) {
    message($lang_common['No permission']);
}
// If it is a comment topic, we redirect to the document
if (get_is_comment($cur_topic['forum_id']) && !isset($_GET['forum'])) {
    $doc_param = get_doc_param($cur_topic['subject']);
    header('Location: ' . $doc_param[2] . $doc_param[3], true, 301);
    exit;
}
// If it is a pub forum, we don't want thatsearch engine follow links
$pub_forums = explode(', ', PUB_FORUMS . ', ' . LOVE_FORUMS);
$is_no_index_forum = in_array($cur_topic['forum_id'], $pub_forums);
if ($is_no_index_forum) {
    $rel = ' rel="nofollow"';
} else {
    $rel = '';
}
// Can we or can we not post replies?
if ($cur_topic['closed'] == '0') {
    if ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1' || $cur_topic['post_replies'] == '1' || $is_admmod) {
        $post_link = '<a href="post.php?tid=' . $id . '" rel="nofollow">' . $lang_topic['Post reply'] . '</a>';
Example #3
0
     } else {
         update_topic($old_topic_id);
         update_forum($old_fid);
         // Update the forum FROM which the topic was moved
         if ($new_forum) {
             update_forum($new_fid);
             // Update the forum TO which the topic was moved
         }
     }
     // clear symfony cache for the corresponding docs view, diff, history.. - in order to have number of comments properly displayed
     if (get_is_comment($old_fid)) {
         $doc_param = get_doc_param($subject);
         c2cTools::clearCommentCache($doc_param[0], $doc_param[1]);
     }
     if (get_is_comment($fid)) {
         $doc_param = get_doc_param($target_subject);
         c2cTools::clearCommentCache($doc_param[0], $doc_param[1]);
     }
     redirect('viewtopic.php?pid=' . $post_id . '#p' . $post_id, $lang_movepost['Mark move redirect']);
 } else {
     // If multiple most must be move, you can't move all the posts at the same time
     if (!isset($post_ids)) {
         // Count the number of posts in the topic
         $result = $db->query('SELECT count(id) FROM ' . $db->prefix . 'posts WHERE topic_id=' . $old_topic_id) or error('Unable to count posts', __FILE__, __LINE__, $db->error());
         $num_post = $db->result($result);
     }
     //Count the topics to diplayed
     $result = $db->query('SELECT count(id) FROM ' . $db->prefix . 'topics WHERE forum_id =' . $fid . ' AND moved_to IS NULL') or error('Unable to count topics', __FILE__, __LINE__, $db->error());
     $num_topics = $db->result($result);
     //Not add the original topic
     if ($fid == $old_fid) {
Example #4
0
                }
            } else {
                $email_sql = $pun_config['p_force_guest_email'] == '1' || $email != '' ? '\'' . $email . '\'' : 'NULL';
                $db->query('UPDATE ' . $db->prefix . 'posts SET poster=\'' . $db->escape($username) . '\', poster_email=' . $email_sql . ', message=\'' . $db->escape($message) . '\', hide_smilies=\'' . $hide_smilies . '\'' . $edited_sql . ' WHERE id=' . $id) or error('Unable to update post', __FILE__, __LINE__, $db->error());
                // update the forums if this is the last post
                $db->query('UPDATE ' . $db->prefix . 'forums SET last_poster=\'' . $db->escape($username) . '\' WHERE last_post_id=' . $id) or error('Unable to update post', __FILE__, __LINE__, $db->error());
                // update the topics if this is the last post
                $db->query('UPDATE ' . $db->prefix . 'topics SET last_poster=\'' . $db->escape($username) . '\' WHERE last_post_id=' . $id) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
                // update the topics if the modified username was the one used for the topic creation
                if ($id == $topic_post_id) {
                    $db->query('UPDATE ' . $db->prefix . 'topics SET poster=\'' . $db->escape($username) . '\' WHERE id=\'' . $cur_post['tid'] . '\'') or error('Unable to update topic', __FILE__, __LINE__, $db->error());
                }
            }
        }
        if ($is_comment) {
            $doc_param = get_doc_param($subject ? $subject : $cur_post['subject']);
            redirect($doc_param[2] . '#p' . $id, $lang_post['Edit redirect']);
        } else {
            redirect('viewtopic.php?pid=' . $id . '#p' . $id, $lang_post['Edit redirect']);
        }
    }
}
$page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / ' . $lang_post['Edit post'];
$required_fields = array('req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
$focus_element = array('edit', 'req_message');
$footer_style = 'edit';
require PUN_ROOT . 'header.php';
$cur_index = 1;
?>
<div class="linkst">
	<div class="inbox">
Example #5
0
                            redirect('viewtopic.php?id=' . $topic_id, $lang_misc['Subscribe redirect']);
                        }
                    } else {
                        if (isset($_GET['unsubscribe'])) {
                            if ($pun_user['is_guest'] || $pun_config['o_subscriptions'] != '1') {
                                message($lang_common['No permission']);
                            }
                            $topic_id = intval($_GET['unsubscribe']);
                            if ($topic_id < 1) {
                                message($lang_common['Bad request']);
                            }
                            $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'subscriptions WHERE user_id=' . $pun_user['id'] . ' AND topic_id=' . $topic_id) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
                            if (!$db->num_rows($result)) {
                                message($lang_misc['Not subscribed']);
                            }
                            $db->query('DELETE FROM ' . $db->prefix . 'subscriptions WHERE user_id=' . $pun_user['id'] . ' AND topic_id=' . $topic_id) or error('Unable to remove subscription', __FILE__, __LINE__, $db->error());
                            if (isset($_GET['doc'])) {
                                $doc_param = get_doc_param($_GET['doc']);
                                redirect($doc_param[2], $lang_misc['Unsubscribe redirect']);
                            } else {
                                redirect('viewtopic.php?id=' . $topic_id, $lang_misc['Unsubscribe redirect']);
                            }
                        } else {
                            message($lang_common['Bad request']);
                        }
                    }
                }
            }
        }
    }
}