Exemplo n.º 1
0
function phpbb_com_titania_post_edit($hook, &$post_object)
{
    if (defined('IN_TITANIA_CONVERT') || !$post_object->phpbb_post_id) {
        return;
    }
    $forum_id = phpbb_com_forum_id($post_object->topic->topic_category, $post_object->post_type);
    if (!$forum_id) {
        return;
    }
    titania::_include('functions_posting', 'phpbb_posting');
    $post_text = $post_object->post_text;
    titania_decode_message($post_text, $post_object->post_text_uid);
    $post_text .= "\n\n" . titania_url::remove_sid($post_object->get_url());
    $options = array('post_id' => $post_object->phpbb_post_id, 'topic_title' => $post_object->post_subject, 'post_text' => $post_text);
    phpbb_posting('edit', $options);
}
Exemplo n.º 2
0
    /**
     * Update the release topic for this contribution
     */
    public function update_release_topic()
    {
        if (titania_types::$types[$this->contrib_type]->forum_robot && titania_types::$types[$this->contrib_type]->forum_database && titania_types::$types[$this->contrib_type]->create_public) {
            titania::_include('functions_posting', 'phpbb_posting');
            // Get the latest download
            $this->get_download();
            // If there is not a download do not update.
            if (!$this->download) {
                return;
            }
            // Get the latest revision
            $this->get_revisions();
            // If there is not a revision do not update.
            if (!$this->revisions) {
                return;
            }
            $phpbb_version = $this->revisions[$this->download['revision_id']]['phpbb_versions'][0];
            $contrib_description = $this->contrib_desc;
            titania_decode_message($contrib_description, $this->contrib_desc_uid);
            // Global body and options
            $body = sprintf(phpbb::$user->lang[titania_types::$types[$this->contrib_type]->create_public], $this->contrib_name, titania_url::remove_sid($this->author->get_url()), users_overlord::get_user($this->author->user_id, '_username'), $contrib_description, $this->download['revision_version'], titania_url::build_clean_url('download', array('id' => $this->download['attachment_id'])), $this->download['real_filename'], $this->download['filesize'], titania_url::remove_sid($this->get_url()), titania_url::remove_sid($this->get_url('support')), $phpbb_version['phpbb_version_branch'][0] . '.' . $phpbb_version['phpbb_version_branch'][1] . '.' . $phpbb_version['phpbb_version_revision']);
            $options = array('poster_id' => titania_types::$types[$this->contrib_type]->forum_robot, 'forum_id' => titania_types::$types[$this->contrib_type]->forum_database);
            if ($this->contrib_release_topic_id) {
                // We edit the first post of contrib release topic
                $options_edit = array('topic_id' => $this->contrib_release_topic_id, 'topic_title' => $this->contrib_name, 'post_text' => $body);
                $options_edit = array_merge($options_edit, $options);
                phpbb_posting('edit_first_post', $options_edit);
            } else {
                // We create a new topic in database
                $options_post = array('topic_title' => $this->contrib_name, 'post_text' => $body);
                $options_post = array_merge($options_post, $options);
                $this->contrib_release_topic_id = phpbb_posting('post', $options_post);
                $sql = 'UPDATE ' . $this->sql_table . '
					SET contrib_release_topic_id = ' . $this->contrib_release_topic_id . '
					WHERE contrib_id = ' . $this->contrib_id;
                phpbb::$db->sql_query($sql);
            }
        }
    }