public function __construct($object) { self::$asgarosforum = $object; $upload_dir = wp_upload_dir(); self::$upload_path = $upload_dir['basedir'] . '/' . self::AF_UPLOADFOLDER . '/'; self::$upload_url = $upload_dir['baseurl'] . '/' . self::AF_UPLOADFOLDER . '/'; self::$upload_allowed_filetypes = explode(',', self::$asgarosforum->options['allowed_filetypes']); }
echo esc_html(stripslashes($threadname)); ?> "> </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 {
<?php $post_content = make_clickable(wpautop($wp_embed->autoembed(stripslashes($post->text)))); if ($this->options['allow_shortcodes']) { // Prevent executing specific shortcodes in posts. $filtered_shortcodes = array(); $filtered_shortcodes[] = 'forum'; $filtered_shortcodes = apply_filters('asgarosforum_filter_post_shortcodes', $filtered_shortcodes); foreach ($filtered_shortcodes as $value) { remove_shortcode($value); } // Run shortcodes. $post_content = do_shortcode($post_content); } $post_content = apply_filters('asgarosforum_filter_post_content', $post_content); echo $post_content; 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)) . ' · '; } 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>
function remove_post() { $post_id = isset($_GET['post']) && is_numeric($_GET['post']) ? absint($_GET['post']) : 0; if (AsgarosForumPermissions::isModerator('current') && $this->element_exists($post_id, $this->tables->posts)) { $this->db->delete($this->tables->posts, array('id' => $post_id), array('%d')); AsgarosForumUploads::deletePostFiles($post_id); } }
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; }