Ejemplo n.º 1
0
 public static function get_queue_object($queue_id, $query = false)
 {
     if (!isset(self::$queue[$queue_id]) && $query) {
         self::load_queue($queue_id);
     }
     if (!isset(self::$queue[$queue_id])) {
         return false;
     }
     $queue = new titania_queue();
     $queue->__set_array(self::$queue[$queue_id]);
     return $queue;
 }
Ejemplo n.º 2
0
 /**
  * Run AutoMOD Tests.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function automod()
 {
     if (!$this->contrib->type->automod_test) {
         return $this->helper->error('INVALID_TOOl');
     }
     $this->package->ensure_extracted();
     // Start up the machine
     $prevalidator = $this->contrib->type->get_prevalidator();
     // Automod testing time
     $details = '';
     $html_results = $bbcode_results = array();
     $this->revision->load_phpbb_versions();
     foreach ($this->revision->phpbb_versions as $row) {
         $version_string = $row['phpbb_version_branch'][0] . '.' . $row['phpbb_version_branch'][1] . '.' . $row['phpbb_version_revision'];
         $phpbb_path = $prevalidator->get_helper()->prepare_phpbb_test_directory($version_string);
         if ($phpbb_path === false) {
             continue;
         }
         $this->template->assign_vars(array('PHPBB_VERSION' => $version_string, 'TEST_ID' => $row['row_id']));
         $html_result = $bbcode_result = '';
         $prevalidator->run_automod_test($this->package, $phpbb_path, $details, $html_result, $bbcode_result);
         $bbcode_results[] = $bbcode_result;
     }
     $bbcode_results = $this->get_result_post('VALIDATION_AUTOMOD', implode("\n\n", $bbcode_results));
     // Update the queue with the results
     $post = $this->queue->topic_reply($bbcode_results);
     $this->package->cleanup();
     redirect($post->get_url());
 }
Ejemplo n.º 3
0
 /**
  * Check whether the author is subscribed to the queue discussion topic.
  *
  * @return bool
  */
 protected function is_author_subscribed()
 {
     if ($this->use_queue) {
         $this->queue->contrib_id = $this->contrib->contrib_id;
         // Get queue discussion topic id if it exists
         $this->queue->get_queue_discussion_topic(true);
         if (!empty($this->queue->queue_discussion_topic_id)) {
             // Is the author subscribed already?
             return $this->subscriptions->is_subscribed(TITANIA_TOPIC, $this->queue->queue_discussion_topic_id);
         }
     }
     return false;
 }
Ejemplo n.º 4
0
 /**
  * Common approval/denial message handler.
  *
  * @param string $action			Action: approve|deny
  * @return bool Returns true if message was submmited properly.
  */
 protected function validate($action)
 {
     $this->queue->message_fields_prefix = 'message_validation';
     $message = $this->get_message($this->queue);
     $error = array();
     if ($message->submit_check()) {
         // Check form key
         if (($form_key_error = $message->validate_form_key()) !== false) {
             $error[] = $form_key_error;
         }
         if (empty($error)) {
             return true;
         }
     }
     $message->display();
     $this->contrib->type->display_validation_options($action, $this->request, $this->template);
     $this->display_topic_review();
     $this->template->assign_vars(array('ERROR' => implode('<br />', $error), 'L_TOPIC_REVIEW' => $this->user->lang['QUEUE_REVIEW'], 'TOPIC_TITLE' => $this->contrib->contrib_name, 'PAGE_TITLE_EXPLAIN' => $this->user->lang[strtoupper($action) . '_QUEUE_CONFIRM'], 'S_CONFIRM_ACTION' => $this->queue->get_url($action)));
     return false;
 }
Ejemplo n.º 5
0
    public function queue($mode, $queue_id = false)
    {
        switch ($mode) {
            case 'update_first_queue_post':
                $queue = new titania_queue();
                $contrib = new titania_contribution();
                $sql = 'SELECT * FROM ' . TITANIA_QUEUE_TABLE . ' q, ' . TITANIA_CONTRIBS_TABLE . ' c
					WHERE c.contrib_id = q.contrib_id' . ($queue_id ? ' AND queue_id = ' . (int) $queue_id : '');
                $result = phpbb::$db->sql_query($sql);
                while ($row = phpbb::$db->sql_fetchrow($result)) {
                    $contrib->__set_array($row);
                    $queue->__set_array($row);
                    $queue->update_first_queue_post(false, $contrib);
                }
                phpbb::$db->sql_freeresult($result);
                unset($queue);
                break;
            case 'revision_queue_id':
                $sql = 'SELECT queue_id, revision_id FROM ' . TITANIA_QUEUE_TABLE;
                $result = phpbb::$db->sql_query($sql);
                while ($row = phpbb::$db->sql_fetchrow($result)) {
                    $sql = 'UPDATE ' . TITANIA_REVISIONS_TABLE . ' SET revision_queue_id = ' . (int) $row['queue_id'] . '
						WHERE revision_id = ' . (int) $row['revision_id'];
                    phpbb::$db->sql_query($sql);
                }
                phpbb::$db->sql_freeresult($result);
                break;
        }
    }
Ejemplo n.º 6
0
    /**
     * Get the queue object for this revision
     */
    public function get_queue()
    {
        $sql = 'SELECT * FROM ' . TITANIA_QUEUE_TABLE . '
			WHERE contrib_id = ' . $this->contrib_id . '
				AND revision_id = ' . $this->revision_id;
        $result = phpbb::$db->sql_query($sql);
        $row = phpbb::$db->sql_fetchrow($result);
        phpbb::$db->sql_freeresult($result);
        if ($row) {
            $queue = new titania_queue();
            $queue->__set_array($row);
            return $queue;
        }
        return false;
    }
Ejemplo n.º 7
0
    /**
     * Sync queue
     *
     * @param string $mode
     * @param int|bool $queue_id	(Optional) Queue id to limit to. Defaults to false.
     */
    public function queue($mode, $queue_id = false)
    {
        switch ($mode) {
            case 'update_first_queue_post':
                $queue = new \titania_queue();
                $contrib = new \titania_contribution();
                $sql = 'SELECT *
					FROM ' . $this->queue_table . ' q, ' . $this->contribs_table . ' c
					WHERE c.contrib_id = q.contrib_id' . ($queue_id ? ' AND queue_id = ' . (int) $queue_id : '');
                $result = $this->db->sql_query($sql);
                while ($row = $this->db->sql_fetchrow($result)) {
                    $contrib->__set_array($row);
                    $contrib->set_type($row['contrib_type']);
                    $queue->__set_array($row);
                    $queue->update_first_queue_post(false, $contrib);
                }
                $this->db->sql_freeresult($result);
                unset($queue);
                break;
            case 'revision_queue_id':
                $sql = 'SELECT queue_id, revision_id
					FROM ' . $this->queue_table;
                $result = $this->db->sql_query($sql);
                while ($row = $this->db->sql_fetchrow($result)) {
                    $sql = 'UPDATE ' . $this->revisions_table . '
						SET revision_queue_id = ' . (int) $row['queue_id'] . '
						WHERE revision_id = ' . (int) $row['revision_id'];
                    $this->db->sql_query($sql);
                }
                $this->db->sql_freeresult($result);
                break;
        }
    }
Ejemplo n.º 8
0
    }
    // Check auth
    if (!titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate') && !$old_queue->allow_author_repack) {
        titania::needs_auth();
    }
    $old_revision->load_phpbb_versions();
    generate_phpbb_version_select($old_revision->get_selected_branches());
    // Assign some defaults
    phpbb::$template->assign_vars(array('REVISION_NAME' => $old_revision->revision_name, 'REVISION_VERSION' => $old_revision->revision_version, 'REVISION_LICENSE' => $old_revision->revision_license, 'S_REPACK' => true));
} else {
    if (titania::$contrib->in_queue()) {
        trigger_error('REVISION_IN_QUEUE');
    }
    generate_phpbb_version_select();
    if (titania::$config->use_queue && titania_types::$types[titania::$contrib->contrib_type]->use_queue) {
        $queue = new titania_queue();
        // Load the message object
        $message_object = new titania_message($queue);
        $message_object->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies')));
        $message_object->set_settings(array('display_error' => false, 'display_subject' => false));
        $queue->post_data($message_object);
        $message_object->display();
    }
}
do {
    $revision_attachment = $revision = false;
    $display_main = false;
    // Display the main upload page?
    $next_step = $step + 1;
    // Default to the next step...
    $try_again = false;
Ejemplo n.º 9
0
 /**
  * @{inheritDoc}
  */
 public function approve(\titania_contribution $contrib, \titania_queue $queue, request_interface $request)
 {
     if (!$request->is_set_post('style_demo_install')) {
         return;
     }
     $revision = $queue->get_revision();
     $this->install_demo($contrib, $revision);
 }