public function submit() { // @todo search indexer on posts (reindex all in case the topic_access level has changed)) $this->topic_subject_clean = url::generate_slug($this->topic_subject); parent::submit(); // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this); }
public function submit() { // Subscriptions if (!$this->attention_id) { $u_view = $this->controller_helper->route('phpbb.titania.manage.attention.redirect', array('type' => $this->attention_type, 'id' => $this->attention_object_id)); $email_vars = array('NAME' => $this->attention_title, 'U_VIEW' => $this->path_helper->strip_url_params($u_view, 'sid')); $this->subscriptions->send_notifications(TITANIA_ATTENTION, 0, 'subscribe_notify', $email_vars, $this->attention_poster_id); } parent::submit(); }
/** * Add a Rating for an item * * @param mixed $rating The rating */ public function add_rating($rating) { if ($this->cannot_rate || !phpbb::$user->data['is_registered'] || !phpbb::$auth->acl_get('u_titania_rate')) { return false; } if ($rating < 0 || $rating > titania::$config->max_rating || $this->rating_id) { return false; } $this->rating_value = $rating; parent::submit(); // This is accurate enough as long as we have at least 2 decimal places $sql = "UPDATE {$this->cache_table} SET\n\t\t\t{$this->cache_rating} = ({$this->cache_rating} * {$this->rating_count} + {$this->rating_value}) / ({$this->rating_count} + 1),\n\t\t\t{$this->cache_rating_count} = {$this->cache_rating_count} + 1\n\t\t\tWHERE {$this->object_column} = {$this->rating_object_id}"; phpbb::$db->sql_query($sql); return true; }
/** * Update/create the queue entry for this revision * * @param array $exclude_from_closing Revisions to exclude from getting marked as repacked/resubmitted * upon the new revision getting added to the queue. */ public function update_queue($exclude_from_closing = array()) { // Create the queue entry if required, else update it if (titania::$config->use_queue && $this->contrib->type->use_queue) { $queue = $this->get_queue(); // Only create the queue for revisions set as new if ($queue === false && ($this->revision_status == TITANIA_REVISION_NEW || $this->revision_status == TITANIA_REVISION_ON_HOLD)) { $queue = new titania_queue(); } // If we have to create or update one... if ($queue !== false) { $queue->__set_array(array('revision_id' => $this->revision_id, 'contrib_id' => $this->contrib_id, 'contrib_name_clean' => $this->contrib->contrib_name_clean)); // Set the queue status to new if it's submitted and the queue status is set to hide it if ($this->revision_submitted && $queue->queue_status == TITANIA_QUEUE_HIDE) { // Only set the queue as new if there are not any newer revisions in the queue $sql = 'SELECT queue_id FROM ' . TITANIA_QUEUE_TABLE . ' WHERE contrib_id = ' . (int) $this->contrib_id . ' AND revision_id > ' . $this->revision_id; $result = phpbb::$db->sql_query($sql); if (!($row = phpbb::$db->sql_fetchrow($result))) { $queue->queue_status = TITANIA_QUEUE_NEW; } } $queue->submit(); // Set the revision queue id $this->revision_queue_id = $queue->queue_id; parent::submit(); if ($this->revision_submitted) { $exclude = ''; if (!empty($exclude_from_closing)) { $exclude = 'AND ' . phpbb::$db->sql_in_set('revision_id', $exclude_from_closing, true); } // Change the status on any old revisions that were in the queue and marked as New to repacked $sql = 'SELECT * FROM ' . TITANIA_QUEUE_TABLE . ' WHERE contrib_id = ' . (int) $this->contrib_id . ' AND revision_id < ' . $this->revision_id . "\n\t\t\t\t\t\t\t{$exclude}\n\t\t\t\t\t\t\tAND queue_status = " . TITANIA_QUEUE_NEW; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $queue = new titania_queue(); $queue->__set_array($row); $queue->close(TITANIA_REVISION_RESUBMITTED); unset($queue); } phpbb::$db->sql_freeresult($result); } } } }
/** * Submit the attachment. * Handles setting orphans, access level, and comment * * @param array|null $data Fields to update. * @return $this */ public function submit($data = null) { if (!$this->get_id()) { parent::submit(); return $this; } if (!empty($data)) { $sql = 'UPDATE ' . $this->sql_table . ' SET ' . $this->db->sql_build_array('UPDATE', $data) . ' WHERE attachment_id = ' . $this->get_id(); $this->db->sql_query($sql); $this->__set_array($data); } return $this; }