コード例 #1
0
ファイル: topic.php プロジェクト: kairion/customisation-db
 public function submit()
 {
     // @todo search indexer on posts (reindex all in case the topic_access level has changed))
     $this->topic_subject_clean = titania_url::url_slug($this->topic_subject);
     parent::submit();
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
 }
コード例 #2
0
 public function submit()
 {
     $this->attention_url = titania_url::unbuild_url($this->attention_url);
     // Subscriptions
     if (!$this->attention_id) {
         $email_vars = array('NAME' => $this->attention_title, 'U_VIEW' => titania_url::build_url('manage/attention', array('type' => $this->attention_type, 'id' => $this->attention_object_id)));
         titania_subscriptions::send_notifications(TITANIA_ATTENTION, 0, 'subscribe_notify.txt', $email_vars, $this->attention_poster_id);
     }
     parent::submit();
 }
コード例 #3
0
ファイル: rating.php プロジェクト: Gfksx/customisation-db
    /**
     * Delete the user's own rating
     */
    public function delete_rating()
    {
        if (!phpbb::$user->data['is_registered'] || !$this->rating_id) {
            return false;
        }
        parent::delete();
        if ($this->rating_count == 1) {
            $sql_ary = array($this->cache_rating => 0, $this->cache_rating_count => 0);
            $sql = 'UPDATE ' . $this->cache_table . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . '
				WHERE ' . $this->object_column . ' = ' . $this->rating_object_id;
            phpbb::$db->sql_query($sql);
        } else {
            // This is accurate enough as long as we have at least 2 decimal places
            $sql = "UPDATE {$this->cache_table} SET\n\t\t\t\t{$this->cache_rating} = ({$this->cache_rating} * {$this->rating_count} - {$this->rating_value}) / ({$this->rating_count} - 1),\n\t\t\t\t{$this->cache_rating_count} = {$this->cache_rating_count} - 1\n\t\t\t\tWHERE {$this->object_column} = {$this->rating_object_id}";
            phpbb::$db->sql_query($sql);
        }
        return true;
    }
コード例 #4
0
ファイル: revision.php プロジェクト: Gfksx/customisation-db
    /**
     * Update/create the queue entry for this revision
     */
    public function update_queue()
    {
        // Create the queue entry if required, else update it
        if (titania::$config->use_queue && titania_types::$types[$this->contrib->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) {
                $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) {
                    // 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 . '
							AND 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);
                }
            }
        }
    }
コード例 #5
0
ファイル: attachment.php プロジェクト: Gfksx/customisation-db
 /**
  * Removes file from server and database.
  *
  * @return void
  */
 public function delete($attachment_id = false)
 {
     $attachment_id = $attachment_id === false ? $this->attachment_id : (int) $attachment_id;
     if (!$attachment_id) {
         return;
     }
     if ($attachment_id == $this->attachment_id) {
         @unlink(titania::$config->upload_path . utf8_basename($this->attachment_directory) . '/' . utf8_basename($this->physical_filename));
         @unlink(titania::$config->upload_path . utf8_basename($this->attachment_directory) . '/thumb_' . utf8_basename($this->physical_filename));
         parent::delete();
     } else {
         if (isset($this->attachments[$attachment_id])) {
             @unlink(titania::$config->upload_path . utf8_basename($this->attachments[$attachment_id]['attachment_directory']) . '/' . utf8_basename($this->attachments[$attachment_id]['physical_filename']));
             @unlink(titania::$config->upload_path . utf8_basename($this->attachments[$attachment_id]['attachment_directory']) . '/thumb_' . utf8_basename($this->attachments[$attachment_id]['physical_filename']));
             $sql = 'DELETE FROM ' . $this->sql_table . ' WHERE attachment_id = ' . $attachment_id;
             phpbb::$db->sql_query($sql);
         }
     }
     if (isset($this->attachments[$attachment_id])) {
         unset($this->attachments[$attachment_id]);
     }
 }
コード例 #6
0
 /**
  * Removes file from server and database.
  *
  * @return void
  */
 public function delete($attachment_id = false)
 {
     $attachment_id = $attachment_id === false ? $this->attachment_id : (int) $attachment_id;
     if (!$attachment_id) {
         return;
     }
     if ($attachment_id == $this->attachment_id) {
         @unlink(titania::$config->upload_path . utf8_basename($this->attachment_directory) . '/' . utf8_basename($this->physical_filename));
         @unlink(titania::$config->upload_path . utf8_basename($this->attachment_directory) . '/thumb_' . utf8_basename($this->physical_filename));
         parent::delete();
     } else {
         if (isset($this->attachments[$attachment_id])) {
             @unlink(titania::$config->upload_path . utf8_basename($this->attachments[$attachment_id]['attachment_directory']) . '/' . utf8_basename($this->attachments[$attachment_id]['physical_filename']));
             @unlink(titania::$config->upload_path . utf8_basename($this->attachments[$attachment_id]['attachment_directory']) . '/thumb_' . utf8_basename($this->attachments[$attachment_id]['physical_filename']));
             $sql = 'DELETE FROM ' . $this->sql_table . ' WHERE attachment_id = ' . $attachment_id;
             phpbb::$db->sql_query($sql);
             if ($this->attachments[$attachment_id]['is_preview'] && ($this->attachments[$attachment_id]['object_type'] == TITANIA_SCREENSHOT || $this->attachments[$attachment_id]['object_type'] == TITANIA_CLR_SCREENSHOT)) {
                 $set_new_preview = true;
             }
         }
     }
     if (isset($this->attachments[$attachment_id])) {
         unset($this->attachments[$attachment_id]);
     }
     // set the next screenshot as preview
     if (key($this->attachments) && isset($set_new_preview) && $set_new_preview) {
         $this->set_preview(key($this->attachments));
     }
 }