Exemplo n.º 1
0
        ?>
">
                    </span>
                </div>
            <?php 
    }
    ?>
            <div class="editor-row no-padding">
                <?php 
    wp_editor(stripslashes($threadcontent), 'message', $this->options_editor);
    ?>
            </div>
            <?php 
    AsgarosForumUploads::getFileList($post);
    AsgarosForumUploads::showEditorUploadForm();
    AsgarosForumNotifications::showEditorSubscriptionOption();
    do_action('asgarosforum_editor_custom_content_bottom');
    ?>
            <div class="editor-row">
                <?php 
    if ($this->current_view === 'addthread') {
        ?>
                    <input type="hidden" name="submit_action" value="add_thread">
                <?php 
    } else {
        if ($this->current_view === 'addpost') {
            ?>
                    <input type="hidden" name="submit_action" value="add_post">
                <?php 
        } else {
            if ($this->current_view === 'editpost') {
Exemplo n.º 2
0
    AsgarosForumUploads::getFileList($post);
    echo '<div class="post-footer">';
    if ($this->options['show_edit_date'] && strtotime($post->date_edit) > strtotime($post->date)) {
        echo sprintf(__('Last edited on %s', 'asgaros-forum'), $this->format_date($post->date_edit)) . '&nbsp;&middot;&nbsp;';
    }
    echo '<a href="' . $this->get_postlink($this->current_topic, $post->id, $this->current_page + 1) . '">#' . ($this->options['posts_per_page'] * $this->current_page + $counter) . '</a>';
    echo '</div>';
    do_action('asgarosforum_after_post_message', $post->author_id, $post->id);
    ?>
                </div>
            </div>
        </div>
    <?php 
}
?>
</div>

<div>
    <?php 
echo $pageing;
?>
    <div class="forum-menu"><?php 
echo $this->forum_menu('thread', false);
?>
</div>
    <div class="clear"></div>
</div>

<?php 
AsgarosForumNotifications::showTopicSubscriptionLink();
Exemplo n.º 3
0
 function delete_forum($forum_id, $category_id)
 {
     global $asgarosforum;
     // Delete all subforums first
     $subforums = $asgarosforum->get_forums($category_id, $forum_id);
     if (count($subforums) > 0) {
         foreach ($subforums as $subforum) {
             $this->delete_forum($subforum->id, $category_id);
         }
     }
     // Delete all threads
     $threads = $asgarosforum->db->get_col("SELECT id FROM {$asgarosforum->tables->topics} WHERE parent_id = {$forum_id};");
     if (!empty($threads)) {
         foreach ($threads as $thread) {
             $asgarosforum->delete_thread($thread, true);
         }
     }
     // Delete subscriptions for this forum.
     AsgarosForumNotifications::removeForumSubscriptions($forum_id);
     // Last but not least delete the forum
     $asgarosforum->db->delete($asgarosforum->tables->forums, array('id' => $forum_id), array('%d'));
     $this->saved = true;
 }
Exemplo n.º 4
0
 function delete_thread($thread_id, $admin_action = false)
 {
     if (AsgarosForumPermissions::isModerator('current')) {
         if ($thread_id) {
             // Delete uploads
             $posts = $this->db->get_col($this->db->prepare("SELECT id FROM {$this->tables->posts} WHERE parent_id = %d;", $thread_id));
             foreach ($posts as $post) {
                 AsgarosForumUploads::deletePostFiles($post);
             }
             $this->db->delete($this->tables->posts, array('parent_id' => $thread_id), array('%d'));
             $this->db->delete($this->tables->topics, array('id' => $thread_id), array('%d'));
             AsgarosForumNotifications::removeTopicSubscriptions($thread_id);
             if (!$admin_action) {
                 wp_redirect(html_entity_decode($this->getLink('forum', $this->current_forum)));
                 exit;
             }
         }
     }
 }
Exemplo n.º 5
0
 public static function insertData()
 {
     global $asgarosforum;
     $redirect = '';
     $date = $asgarosforum->current_time();
     if (self::getAction() === 'add_thread') {
         $asgarosforum->db->insert($asgarosforum->tables->topics, array('name' => self::$dataSubject, 'parent_id' => $asgarosforum->current_forum), array('%s', '%d'));
         $asgarosforum->current_topic = $asgarosforum->db->insert_id;
         $uploadList = AsgarosForumUploads::prepareFileList();
         $asgarosforum->db->insert($asgarosforum->tables->posts, array('text' => self::$dataContent, 'parent_id' => $asgarosforum->current_topic, 'date' => $date, 'author_id' => get_current_user_id(), 'uploads' => maybe_serialize($uploadList)), array('%s', '%d', '%s', '%d', '%s'));
         $asgarosforum->current_post = $asgarosforum->db->insert_id;
         AsgarosForumUploads::uploadFiles($asgarosforum->current_post, $uploadList);
         $redirect = html_entity_decode($asgarosforum->getLink('topic', $asgarosforum->current_topic, false, '#postid-' . $asgarosforum->current_post));
         // Send notification about new topic to global subscribers.
         AsgarosForumNotifications::notifyGlobalTopicSubscribers(self::$dataSubject, self::$dataContent, $redirect);
     } else {
         if (self::getAction() === 'add_post') {
             $uploadList = AsgarosForumUploads::prepareFileList();
             $asgarosforum->db->insert($asgarosforum->tables->posts, array('text' => self::$dataContent, 'parent_id' => $asgarosforum->current_topic, 'date' => $date, 'author_id' => get_current_user_id(), 'uploads' => maybe_serialize($uploadList)), array('%s', '%d', '%s', '%d', '%s'));
             $asgarosforum->current_post = $asgarosforum->db->insert_id;
             AsgarosForumUploads::uploadFiles($asgarosforum->current_post, $uploadList);
             $redirect = html_entity_decode($asgarosforum->get_postlink($asgarosforum->current_topic, $asgarosforum->current_post));
             // Send notification about new post to subscribers
             AsgarosForumNotifications::notifyTopicSubscribers(self::$dataContent, $redirect);
         } else {
             if (self::getAction() === 'edit_post') {
                 $uploadList = AsgarosForumUploads::uploadFiles($asgarosforum->current_post);
                 $asgarosforum->db->update($asgarosforum->tables->posts, array('text' => self::$dataContent, 'uploads' => maybe_serialize($uploadList), 'date_edit' => $date), array('id' => $asgarosforum->current_post), array('%s', '%s', '%s'), array('%d'));
                 if ($asgarosforum->is_first_post($asgarosforum->current_post) && !empty(self::$dataSubject)) {
                     $asgarosforum->db->update($asgarosforum->tables->topics, array('name' => self::$dataSubject), array('id' => $asgarosforum->current_topic), array('%s'), array('%d'));
                 }
                 $redirect = html_entity_decode($asgarosforum->get_postlink($asgarosforum->current_topic, $asgarosforum->current_post, $_POST['part_id']));
             }
         }
     }
     AsgarosForumNotifications::updateSubscriptionStatus();
     do_action('asgarosforum_after_' . self::getAction() . '_submit', $asgarosforum->current_post);
     wp_redirect($redirect);
     exit;
 }