Пример #1
0
 /**
  * Display support topics from all contributions or of a specific type.
  *
  * @param string $type	Contribution type's string identifier
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display_topics($type)
 {
     $type_id = $this->get_type_id($type);
     if ($type_id === false) {
         return $this->helper->error('NO_PAGE', 404);
     }
     if ($type == 'all') {
         // Mark all topics read
         if ($this->request->variable('mark', '') == 'topics') {
             $this->tracking->track(TITANIA_ALL_SUPPORT, self::ALL_SUPPORT);
         }
         // Mark all topics read
         $this->template->assign_var('U_MARK_TOPICS', $this->helper->route('phpbb.titania.support', array('type' => 'all', 'mark' => 'topics')));
     }
     $this->display->assign_global_vars();
     $u_all_support = $this->helper->route('phpbb.titania.support', array('type' => 'all'));
     $this->template->assign_var('U_ALL_SUPPORT', $u_all_support);
     // Generate the main breadcrumbs
     $this->display->generate_breadcrumbs(array('ALL_SUPPORT' => $u_all_support));
     // Links to the support topic lists
     foreach ($this->types->get_all() as $id => $class) {
         $this->template->assign_block_vars('support_types', array('U_SUPPORT' => $this->helper->route('phpbb.titania.support', array('type' => $class->url)), 'TYPE_SUPPORT' => $class->langs));
     }
     $data = \topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id));
     // Canonical URL
     $data['sort']->set_url($this->helper->route('phpbb.titania.support', array('type' => $type)));
     $this->template->assign_var('U_CANONICAL', $data['sort']->build_canonical());
     return $this->helper->render('all_support.html', 'CUSTOMISATION_DATABASE');
 }
Пример #2
0
 /**
  * Get the post object
  *
  * @param <int> $post_id
  * @return <object|bool> False if the post does not exist in the self::$posts array (load it first!) post object if it exists
  */
 public static function get_post_object($post_id)
 {
     if (!isset(self::$posts[$post_id])) {
         return false;
     }
     // One can hope...
     $topic = topics_overlord::get_topic_object(self::$posts[$post_id]['topic_id']);
     $post = new titania_post(self::$posts[$post_id]['post_type'], $topic);
     $post->__set_array(self::$posts[$post_id]);
     return $post;
 }
Пример #3
0
 /**
  * Quick load a topic
  *
  * @param int $topic_id
  * @return \titania_topic
  * @throws \OutOfBoundsException	Throws exception if the topic does not exist.
  */
 public function load_topic($topic_id)
 {
     \topics_overlord::load_topic($topic_id);
     $topic = \topics_overlord::get_topic_object($topic_id);
     if ($topic === false) {
         throw new \OutOfBoundsException($this->user->lang('NO_TOPIC'));
     }
     return $topic;
 }
Пример #4
0
phpbb::$user->add_lang('viewforum');
if ($topic_id) {
    // Subscriptions
    titania_subscriptions::handle_subscriptions(TITANIA_TOPIC, $topic_id, $topic->get_url());
    // Check access level
    if ($topic->topic_access < titania::$access_level || $topic->topic_type == TITANIA_QUEUE_DISCUSSION && !titania::$contrib->is_author && !titania::$contrib->is_active_coauthor && !titania_types::$types[titania::$contrib->contrib_type]->acl_get('queue_discussion')) {
        titania::needs_auth();
    }
    posts_overlord::display_topic_complete($topic);
    titania::page_header(censor_text($topic->topic_subject) . ' - ' . titania::$contrib->contrib_name);
    if (phpbb::$auth->acl_get('u_titania_post')) {
        phpbb::$template->assign_var('U_POST_REPLY', titania_url::append_url($topic->get_url(), array('action' => 'reply')));
    }
    // Canonical URL
    phpbb::$template->assign_var('U_CANONICAL', $topic->get_url());
} else {
    // Subscriptions
    titania_subscriptions::handle_subscriptions(TITANIA_SUPPORT, titania::$contrib->contrib_id, titania::$contrib->get_url('support'));
    // Mark all topics read
    if (request_var('mark', '') == 'topics') {
        titania_tracking::track(TITANIA_SUPPORT, titania::$contrib->contrib_id);
    }
    $data = topics_overlord::display_forums_complete('support', titania::$contrib);
    titania::page_header(titania::$contrib->contrib_name . ' - ' . phpbb::$user->lang['CONTRIB_SUPPORT']);
    if (phpbb::$auth->acl_get('u_titania_topic') && titania::$config->support_in_titania) {
        phpbb::$template->assign_var('U_POST_TOPIC', titania_url::append_url(titania::$contrib->get_url('support'), array('action' => 'post')));
    }
    $data['sort']->set_url(titania::$contrib->get_url('support'));
    phpbb::$template->assign_vars(array('U_MARK_TOPICS' => titania_url::append_url(titania::$contrib->get_url('support'), array('mark' => 'topics')), 'U_CANONICAL' => $data['sort']->build_canonical(), 'S_DISPLAY_SEARCHBOX' => true, 'S_SEARCHBOX_ACTION' => titania_url::build_url('search', array('type' => TITANIA_SUPPORT, 'contrib' => titania::$contrib->contrib_id))));
}
titania::page_footer(true, 'contributions/contribution_support.html');
Пример #5
0
        if (sizeof($authed) == 1) {
            $queue_type = $authed[0];
        } else {
            foreach ($authed as $type_id) {
                $sql = 'SELECT COUNT(topic_id) AS cnt FROM ' . TITANIA_TOPICS_TABLE . '
				WHERE topic_type = ' . TITANIA_QUEUE_DISCUSSION . '
					AND topic_category = ' . (int) $type_id;
                phpbb::$db->sql_query($sql);
                $cnt = phpbb::$db->sql_fetchfield('cnt');
                phpbb::$db->sql_freeresult();
                phpbb::$template->assign_block_vars('categories', array('U_VIEW_CATEGORY' => titania_url::append_url($base_url, array('queue' => titania_types::$types[$type_id]->url)), 'CATEGORY_NAME' => titania_types::$types[$type_id]->lang, 'CATEGORY_CONTRIBS' => $cnt));
            }
            phpbb::$template->assign_vars(array('S_QUEUE_LIST' => true));
            titania::page_header('QUEUE_DISCUSSION');
            titania::page_footer(true, 'manage/queue.html');
        }
    }
} else {
    if (!titania_types::$types[$queue_type]->acl_get('queue_discussion')) {
        titania::needs_auth();
    }
}
// Add the queue type to the base url
$base_url = titania_url::append_url($base_url, array('queue' => titania_types::$types[$queue_type]->url));
// Add to Breadcrumbs
titania::generate_breadcrumbs(array(titania_types::$types[$queue_type]->lang => $base_url));
topics_overlord::display_forums_complete('queue_discussion', false, array('topic_category' => $queue_type));
// Mark all topics read
phpbb::$template->assign_var('U_MARK_TOPICS', titania_url::append_url($base_url, array('mark' => 'topics')));
titania::page_header('QUEUE_DISCUSSION');
titania::page_footer(true, 'manage/queue_discussion.html');
Пример #6
0
 /**
  * Quick load a topic
  *
  * @param mixed $topic_id
  * @return object
  */
 public function load_topic($topic_id)
 {
     topics_overlord::load_topic($topic_id);
     $topic = topics_overlord::get_topic_object($topic_id);
     if ($topic === false) {
         trigger_error('NO_TOPIC');
     }
     return $topic;
 }
Пример #7
0
 /**
  * Display queue discussion type.
  *
  * @param string $queue_type 	Queue type URL identifier.
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display_type($queue_type)
 {
     $type = $this->load_type($queue_type);
     if (!$type->acl_get('queue_discussion')) {
         return $this->helper->needs_auth();
     }
     // Mark all topics read
     if ($this->request->variable('mark', '') == 'topics') {
         $this->tracking->track(TITANIA_QUEUE_DISCUSSION, self::ALL_TYPES);
     }
     $this->display->assign_global_vars();
     $this->generate_navigation('queue_discussion');
     // Add to Breadcrumbs
     $this->display->generate_breadcrumbs(array($type->lang => $this->get_type_url($type)));
     \topics_overlord::display_forums_complete('queue_discussion', false, array('topic_category' => $type->id));
     // Mark all topics read
     $this->template->assign_var('U_MARK_TOPICS', $this->get_type_url($type, array('mark' => 'topics')));
     return $this->helper->render('manage/queue_discussion.html', 'QUEUE_DISCUSSION');
 }
Пример #8
0
 /**
  * Load topic object.
  *
  * @param int $id		Topic id.
  * @throws \Exception	Throws exception if no topic found.
  * @return null
  */
 protected function load_topic($id)
 {
     \topics_overlord::load_topic($id, true);
     $this->topic = \topics_overlord::get_topic_object($id);
     if ($this->topic === false || $this->topic->parent_id !== $this->contrib->contrib_id) {
         throw new \Exception($this->user->lang['NO_TOPIC']);
     }
 }
Пример #9
0
 /**
  * Display author's support topics page.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 protected function support()
 {
     if (!$this->is_owner) {
         return $this->helper->needs_auth();
     }
     // Mark all topics read
     if ($this->request->variable('mark', '') == 'topics') {
         foreach ($this->cache->get_author_contribs($this->author->user_id, $this->types, $this->user) as $contrib_id) {
             $this->tracking->track(TITANIA_SUPPORT, $contrib_id);
         }
     }
     \topics_overlord::display_forums_complete('author_support', $this->author);
     // Mark all topics read
     $this->template->assign_var('U_MARK_TOPICS', $this->author->get_url('support', array('mark' => 'topics')));
     return $this->helper->render('contributions/contribution_support.html', $this->get_title('AUTHOR_SUPPORT'));
 }
Пример #10
0
<?php

/**
 *
 * @package titania
 * @version $Id$
 * @copyright (c) 2008 phpBB Customisation Database Team
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 *
 */
/**
* @ignore
*/
if (!defined('IN_TITANIA')) {
    exit;
}
// Mark all topics read
if (request_var('mark', '') == 'topics') {
    foreach (titania::$cache->get_author_contribs(titania::$author->user_id) as $contrib_id) {
        titania_tracking::track(TITANIA_SUPPORT, $contrib_id);
    }
}
topics_overlord::display_forums_complete('author_support', titania::$author);
// Mark all topics read
phpbb::$template->assign_var('U_MARK_TOPICS', titania_url::build_url(titania::$author->get_url('support'), array('mark' => 'topics')));
titania::page_header(titania::$author->get_username_string('username') . ' - ' . phpbb::$user->lang['AUTHOR_SUPPORT']);
titania::page_footer(true, 'contributions/contribution_support.html');
Пример #11
0
    /**
     * Display forum-like list for queue
     *
     * @param string $type The type of queue (the contrib type)
     * @param object|boolean $sort The sort object (includes/tools/sort.php)
     */
    public static function display_queue($type, $queue_status = TITANIA_QUEUE_NEW, $sort = false)
    {
        if ($sort === false) {
            // Setup the sort tool
            $sort = self::build_sort();
        }
        $sort->request();
        $queue_ids = array();
        $sql_ary = array('SELECT' => '*, u.username as topic_first_post_username, u.user_colour as topic_first_post_user_colour, ul.username as topic_last_post_username, ul.user_colour as topic_last_post_user_colour', 'FROM' => array(TITANIA_QUEUE_TABLE => 'q', TITANIA_CONTRIBS_TABLE => 'c', TITANIA_REVISIONS_TABLE => 'r', TITANIA_TOPICS_TABLE => 't'), 'WHERE' => 'q.queue_type = ' . (int) $type . ($queue_status ? ' AND q.queue_status = ' . (int) $queue_status : ' AND q.queue_status > 0 ') . '
				AND c.contrib_id = q.contrib_id
				AND r.revision_id = q.revision_id
				AND t.topic_id = q.queue_topic_id', 'ORDER_BY' => $sort->get_order_by());
        $sql_ary['LEFT_JOIN'][] = array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 't.topic_first_post_user_id = u.user_id');
        $sql_ary['LEFT_JOIN'][] = array('FROM' => array(USERS_TABLE => 'ul'), 'ON' => 't.topic_last_post_user_id = ul.user_id');
        titania_tracking::get_track_sql($sql_ary, TITANIA_TOPIC, 't.topic_id');
        // Main SQL Query
        $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
        // Handle pagination
        if (!$sort->sql_count($sql_ary, 'q.queue_id')) {
            // No results...no need to query more...
            return;
        }
        $sort->build_pagination(titania_url::$current_page, titania_url::$params);
        $queue_ids = $user_ids = array();
        // Get the data
        $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start);
        while ($row = phpbb::$db->sql_fetchrow($result)) {
            // Store the tracking info we grabbed from the DB
            titania_tracking::store_from_db($row);
            $queue_ids[] = $row['queue_id'];
            $user_ids[] = $row['topic_first_post_user_id'];
            $user_ids[] = $row['topic_last_post_user_id'];
            $user_ids[] = $row['submitter_user_id'];
            self::$queue[$row['queue_id']] = $row;
        }
        phpbb::$db->sql_freeresult($result);
        users_overlord::load_users($user_ids);
        $topic = new titania_topic();
        foreach ($queue_ids as $queue_id) {
            $row = self::$queue[$queue_id];
            $topic->__set_array($row);
            phpbb::$template->assign_block_vars('topics', array_merge($topic->assign_details(), array('TOPIC_SUBJECT' => $row['contrib_name'] . ' - ' . $row['revision_version'], 'S_TOPIC_PROGRESS' => $row['queue_progress'] ? true : false)));
        }
        unset($topic);
        phpbb::$template->assign_vars(array('S_TOPIC_LIST' => true));
        // Assign common stuff for topics list
        topics_overlord::assign_common();
    }
Пример #12
0
 case 'support':
     // The type of contribs (mod, style, converter, official_tool, etc.)
     $type = request_var('type', 'all');
     $type_id = titania_types::type_from_url($type);
     $type = !$type_id ? 'all' : $type;
     if ($type == 'all') {
         // Mark all topics read
         if (request_var('mark', '') == 'topics') {
             titania_tracking::track(TITANIA_SUPPORT, 0);
         }
         // Mark all topics read
         phpbb::$template->assign_var('U_MARK_TOPICS', titania_url::append_url(titania_url::build_url('support/all'), array('mark' => 'topics')));
     }
     // Generate the main breadcrumbs
     titania::generate_breadcrumbs(array('ALL_SUPPORT' => titania_url::build_url('support/' . $type . '/')));
     $data = topics_overlord::display_forums_complete('all_support', false, array('contrib_type' => $type_id));
     // Links to the support topic lists
     foreach (titania_types::$types as $id => $class) {
         phpbb::$template->assign_block_vars('support_types', array('U_SUPPORT' => titania_url::build_url('support/' . $class->url . '/'), 'TYPE_SUPPORT' => $class->langs));
     }
     // Canonical URL
     $data['sort']->set_url('support/' . $type . '/');
     phpbb::$template->assign_var('U_CANONICAL', $data['sort']->build_canonical());
     titania::page_header('CUSTOMISATION_DATABASE');
     titania::page_footer(true, 'all_support.html');
     break;
     /**
      * Display all contributions
      */
 /**
  * Display all contributions