Пример #1
0
    public function submit($update_first_post = true)
    {
        if (!$this->queue_id) {
            $this->user->add_lang_ext('phpbb/titania', 'manage');
            $sql = 'SELECT c.contrib_id, c.contrib_name_clean, c.contrib_name, c.contrib_type, r.revision_version
				FROM ' . TITANIA_CONTRIBS_TABLE . ' c, ' . TITANIA_REVISIONS_TABLE . ' r
				WHERE r.revision_id = ' . (int) $this->revision_id . '
					AND c.contrib_id = r.contrib_id';
            $result = phpbb::$db->sql_query($sql);
            $row = phpbb::$db->sql_fetchrow($result);
            phpbb::$db->sql_freeresult($result);
            if (!$row) {
                trigger_error('NO_CONTRIB');
            }
            $this->queue_type = $row['contrib_type'];
            // Submit here first to make sure we have a queue_id for the topic url
            parent::submit();
            // Is there a queue discussion topic?  If not we should create one
            $this->get_queue_discussion_topic();
            $this->update_first_queue_post(phpbb::$user->lang['VALIDATION'] . ' - ' . $row['contrib_name'] . ' - ' . $row['revision_version']);
        } else {
            if ($update_first_post) {
                $this->update_first_queue_post();
            }
        }
        parent::submit();
        // Hooks
        titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
    }
Пример #2
0
 /**
  * Submit data for storing into the database
  *
  * @return bool
  */
 public function submit()
 {
     if (!$this->user_id) {
         throw new exception('No user_id!');
     }
     return parent::submit();
 }
Пример #3
0
 /**
  * Submit data for storing into the database
  *
  * @return bool
  */
 public function submit()
 {
     // Destroy category cache
     $this->destroy_cache();
     return parent::submit();
 }
Пример #4
0
 public function report($reason = '', $notify_reporter = false)
 {
     // Mark the post as reported
     $this->post_reported = true;
     // Setup the attention object and submit it
     $attention = new titania_attention();
     $attention->__set_array(array('attention_type' => TITANIA_ATTENTION_REPORTED, 'attention_object_type' => TITANIA_POST, 'attention_object_id' => $this->post_id, 'attention_poster_id' => $this->post_user_id, 'attention_post_time' => $this->post_time, 'attention_url' => $this->get_url(), 'attention_title' => $this->post_subject, 'attention_description' => $reason, 'notify_reporter' => $notify_reporter));
     $attention->submit();
     // Update the postcount and mark as reported for the topic and submit it
     $this->update_topic_postcount();
     $this->topic->topic_reported = true;
     $this->topic->submit();
     // Self submission
     parent::submit();
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
 }
Пример #5
0
    /**
     * Submit data for storing into the database
     * DO NOT USE THIS FUNCTION TO CHANGE THE STATUS ELSE THE AUTHORS CONTRIB COUNT WILL BE INCORRECT (use change_status function)!
     */
    public function submit()
    {
        if (!$this->contrib_id) {
            // Make sure the author exists, if not we create one (do this before returning if not approved...else we need to duplicate this code in a bunch of places)
            $user_id = $this->contrib_user_id;
            $sql = 'SELECT user_id FROM ' . TITANIA_AUTHORS_TABLE . '
				WHERE user_id = ' . (int) $user_id;
            phpbb::$db->sql_query($sql);
            if (!phpbb::$db->sql_fetchfield('user_id')) {
                $author = new titania_author($user_id);
                $author->submit();
            }
            phpbb::$db->sql_freeresult();
        }
        if (!$this->contrib_id && in_array($this->contrib_status, array(TITANIA_CONTRIB_APPROVED, TITANIA_CONTRIB_DOWNLOAD_DISABLED))) {
            // Increment the contrib counter
            $this->change_author_contrib_count($this->contrib_user_id);
        }
        // Clear the author contribs cache
        titania::$cache->reset_author_contribs($this->contrib_user_id);
        parent::submit();
        // Index!
        $this->index();
        // Hooks
        titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
    }
Пример #6
0
    /**
     * Update data or submit new faq
     *
     * @return void
     */
    public function submit()
    {
        // Get the FAQ count to update it
        $sql = 'SELECT contrib_faq_count FROM ' . TITANIA_CONTRIBS_TABLE . '
			WHERE contrib_id = ' . $this->contrib_id;
        phpbb::$db->sql_query($sql);
        $contrib_faq_count = phpbb::$db->sql_fetchfield('contrib_faq_count');
        phpbb::$db->sql_freeresult();
        // If already submitted we need to decrement first
        if ($this->faq_id) {
            if (empty($this->sql_data)) {
                throw new exception('Modifying a FAQ entry requires you load it through the load() function (we require the original information).');
            }
            $original_flags = count::update_flags($this->sql_data['faq_access']);
            $contrib_faq_count = count::decrement($contrib_faq_count, $original_flags);
        }
        // Update the FAQ count
        $flags = count::update_flags($this->faq_access);
        $sql = 'UPDATE ' . TITANIA_CONTRIBS_TABLE . '
			SET contrib_faq_count = \'' . phpbb::$db->sql_escape(count::increment($contrib_faq_count, $flags)) . '\'
			WHERE contrib_id = ' . $this->contrib_id;
        phpbb::$db->sql_query($sql);
        // Submit this FAQ item
        parent::submit();
        // Index
        $this->search_manager->index(TITANIA_FAQ, $this->faq_id, array('title' => $this->faq_subject, 'text' => $this->faq_text, 'text_uid' => $this->faq_text_uid, 'text_bitfield' => $this->faq_text_bitfield, 'text_options' => $this->faq_text_options, 'author' => 0, 'date' => 0, 'url' => serialize(array('contrib_type' => $this->contrib->type->url, 'contrib' => $this->contrib->contrib_name_clean)), 'access_level' => $this->faq_access));
    }