예제 #1
0
 /**
  * Allow author to repack revision action.
  *
  * @return null
  */
 protected function allow_author_repack()
 {
     $topic = $this->queue->get_queue_discussion_topic();
     $post = new \titania_post(TITANIA_QUEUE_DISCUSSION, $topic);
     $post->__set_array(array('post_subject' => 'Re: ' . $post->topic->topic_subject));
     // Load the message object
     $message_object = $this->get_message($post);
     // Submit check...handles running $post->post_data() if required
     $submit = $message_object->submit_check();
     if ($submit) {
         $this->queue->allow_author_repack = true;
         $repack_url = $this->contrib->get_url('revision', array('page' => 'repack', 'id' => $this->queue->revision_id));
         $for_edit = $post->generate_text_for_edit();
         $post->post_text = $for_edit['message'] . "\n\n\n\t\t\t\t[url=" . $repack_url . ']' . $this->user->lang['AUTHOR_REPACK_LINK'] . '[/url]';
         $post->generate_text_for_storage($for_edit['allow_bbcode'], $for_edit['allow_smilies'], $for_edit['allow_urls']);
         $post->submit();
         $this->queue->submit();
         $this->queue->topic_reply('QUEUE_REPLY_ALLOW_REPACK');
         $this->queue->submit();
         redirect($this->queue->get_url());
     }
     $message_object->display();
     // Common stuff
     $this->template->assign_vars(array('S_POST_ACTION' => $this->helper->get_current_url(), 'L_POST_A' => $this->user->lang['DISCUSSION_REPLY_MESSAGE']));
     return $this->helper->render('manage/queue_post.html', 'DISCUSSION_REPLY_MESSAGE');
 }
예제 #2
0
 /**
  * Assign navigation tabs.
  *
  * @param string $page	Current active page.
  * @return null
  */
 protected function generate_navigation($page)
 {
     // Count the number of FAQ items to display
     $flags = count::get_flags($this->access->get_level());
     $faq_count = count::from_db($this->contrib->contrib_faq_count, $flags);
     $is_disabled = in_array($this->contrib->contrib_status, array(TITANIA_CONTRIB_CLEANED, TITANIA_CONTRIB_DISABLED));
     /**
      * Menu Array
      *
      * 'filename' => array(
      *	'title'		=> 'nav menu title',
      * 	'url'		=> $page_url,
      *	'auth'		=> ($can_see_page) ? true : false, // Not required, always true if missing
      * ),
      */
     $nav_ary = array('details' => array('title' => 'CONTRIB_DETAILS', 'url' => $this->contrib->get_url()), 'faq' => array('title' => 'CONTRIB_FAQ', 'url' => $this->contrib->get_url('faq'), 'auth' => !$this->access->is_public() || $faq_count, 'count' => $faq_count), 'support' => array('title' => 'CONTRIB_SUPPORT', 'url' => $this->contrib->get_url('support'), 'auth' => $this->ext_config->support_in_titania || $this->access->get_level() < access::PUBLIC_LEVEL), 'demo' => array('title' => 'CONTRIB_DEMO', 'url' => '', 'auth' => !empty($this->contrib->contrib_demo)), 'manage' => array('title' => 'CONTRIB_MANAGE', 'url' => $this->contrib->get_url('manage'), 'auth' => $this->is_author && $this->auth->acl_get('u_titania_post_edit_own') && !$is_disabled || $this->auth->acl_get('u_titania_mod_contrib_mod') || $this->contrib->type->acl_get('moderate')));
     if ($this->contrib->contrib_demo) {
         $demo_menu = array();
         $allowed_branches = $this->contrib->type->get_allowed_branches(true);
         krsort($allowed_branches);
         $is_external = $this->contrib->contrib_status != TITANIA_CONTRIB_APPROVED || !$this->contrib->options['demo'];
         foreach ($allowed_branches as $branch => $name) {
             $demo_url = $this->contrib->get_demo_url($branch, !$is_external);
             if ($demo_url) {
                 $demo_menu[] = array('url' => $demo_url, 'title' => $name, 'external' => $is_external);
             }
         }
         if (sizeof($demo_menu) == 1) {
             $nav_ary['demo']['url'] = $demo_menu[0]['url'];
             $nav_ary['demo']['external'] = $demo_menu[0]['external'];
         } else {
             if (!empty($demo_menu)) {
                 $nav_ary['demo']['sub_menu'] = $demo_menu;
             } else {
                 unset($nav_ary['demo']);
             }
         }
     }
     $this->display->generate_nav($nav_ary, $page, 'details');
 }
예제 #3
0
    function main($id, $mode)
    {
        global $phpbb_root_path;
        define('PHPBB_INCLUDED', true);
        define('USE_PHPBB_TEMPLATE', true);
        define('IN_TITANIA', true);
        if (!defined('PHP_EXT')) {
            define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
        }
        require TITANIA_ROOT . 'common.' . PHP_EXT;
        // Need a few hacks to be used from within phpBB
        titania_url::decode_url(titania::$config->phpbb_script_path);
        titania::$hook->register(array('titania_url', 'build_url'), 'titania_outside_build_url', 'standalone');
        titania::$hook->register(array('titania_url', 'append_url'), 'titania_outside_build_url', 'standalone');
        titania::$hook->register(array('titania', 'page_header'), 'titania_outside_page_header', 'standalone');
        titania::$hook->register(array('titania', 'page_footer'), 'titania_outside_page_footer', 'standalone');
        $this->p_master->assign_tpl_vars(phpbb::append_sid('ucp'));
        // Include some files
        titania::_include('functions_display', 'titania_topic_folder_img');
        // Setup the sort tool
        $sort = new titania_sort();
        $sort->default_limit = phpbb::$config['topics_per_page'];
        $sort->request();
        // Start initial var setup
        $url = $this->u_action;
        add_form_key('ucp_front_subscription');
        // User wants to unsubscribe?
        if (isset($_POST['unsubscribe'])) {
            if (check_form_key('ucp_front_subscription')) {
                $sections = request_var('sections', array(0 => array(0 => 0)));
                $items = request_var('items', array(0 => array(0 => 0)));
                $subscriptions = $sections + $items;
                if (sizeof($subscriptions)) {
                    foreach ($subscriptions as $type => $type_id) {
                        $object_ids = array_keys($type_id);
                        foreach ($object_ids as $object_id) {
                            $sql = 'DELETE FROM ' . TITANIA_WATCH_TABLE . '
								WHERE watch_user_id = ' . phpbb::$user->data['user_id'] . '
								AND watch_object_type = ' . $type . '
								AND watch_object_id = ' . $object_id;
                            phpbb::$db->sql_query($sql);
                        }
                    }
                } else {
                    $msg = phpbb::$user->lang['NO_SUBSCRIPTIONS_SELECTED'];
                }
            } else {
                $msg = phpbb::$user->lang['FORM_INVALID'];
            }
            if (isset($msg)) {
                meta_refresh(3, $url);
                $message = $msg . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>');
                trigger_error($message);
            }
        }
        switch ($mode) {
            case 'subscription_items':
                $array_items = array(TITANIA_CONTRIB, TITANIA_TOPIC);
                // We prepare pagination stuff
                $sql = 'SELECT COUNT(*) AS subscription_count
					FROM ' . TITANIA_WATCH_TABLE . '
					WHERE ' . phpbb::$db->sql_in_set('watch_object_type', $array_items) . '
						AND watch_user_id = ' . phpbb::$user->data['user_id'];
                phpbb::$db->sql_query($sql);
                $subscription_count = phpbb::$db->sql_fetchfield('subscription_count');
                phpbb::$db->sql_freeresult();
                $sort->total = $subscription_count;
                $sort->build_pagination($url);
                $sql_ary = array('SELECT' => '*,
						CASE w.watch_object_type
							WHEN ' . TITANIA_CONTRIB . ' THEN c.contrib_last_update
							WHEN ' . TITANIA_TOPIC . ' THEN t.topic_last_post_time
						END AS time', 'FROM' => array(TITANIA_WATCH_TABLE => 'w'), 'LEFT_JOIN' => array(array('FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'), 'ON' => '(w.watch_object_type = ' . TITANIA_CONTRIB . ')
								AND c.contrib_id = w.watch_object_id'), array('FROM' => array(TITANIA_TOPICS_TABLE => 't'), 'ON' => 'w.watch_object_type = ' . TITANIA_TOPIC . '
								AND t.topic_id = w.watch_object_id')), 'WHERE' => 'w.watch_user_id = ' . phpbb::$user->data['user_id'] . '
						AND ' . phpbb::$db->sql_in_set('watch_object_type', $array_items), 'ORDER_BY' => 'time DESC');
                // Additional tracking for support topics
                titania_tracking::get_track_sql($sql_ary, TITANIA_TOPIC, 't.topic_id');
                titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 0, 'tsa');
                titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 't.parent_id', 'tsc');
                titania_tracking::get_track_sql($sql_ary, TITANIA_QUEUE_DISCUSSION, 0, 'tqt');
                // Tracking for contributions
                titania_tracking::get_track_sql($sql_ary, TITANIA_CONTRIB, 'c.contrib_id', 'tc');
                $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
                // Get the data
                $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start);
                $user_ids = $rows = array();
                while ($row = phpbb::$db->sql_fetchrow($result)) {
                    $rows[] = $row;
                    titania_tracking::store_from_db($row);
                    if ($row['watch_object_type'] == TITANIA_TOPIC) {
                        $user_ids[] = $row['topic_first_post_user_id'];
                        $user_ids[] = $row['topic_last_post_user_id'];
                    } else {
                        if ($row['watch_object_type'] == TITANIA_CONTRIB) {
                            $user_ids[] = $row['contrib_user_id'];
                        }
                    }
                }
                phpbb::$db->sql_freeresult($result);
                // Get user data
                users_overlord::load_users($user_ids);
                foreach ($rows as $row) {
                    $folder_img = $folder_alt = '';
                    if ($row['watch_object_type'] == TITANIA_TOPIC) {
                        if (!$row['topic_id']) {
                            // Topic was deleted
                            $sql = 'DELETE FROM ' . TITANIA_WATCH_TABLE . '
								WHERE watch_object_type = ' . (int) $row['watch_object_type'] . '
									AND watch_object_id = ' . (int) $row['watch_object_id'];
                            phpbb::$db->sql_query($sql);
                            continue;
                        }
                        $topic = new titania_topic();
                        $topic->__set_array($row);
                        $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'id' => 0);
                        $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'parent_match' => true);
                        $topic->additional_unread_fields[] = array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true);
                        $tpl_block = 'items';
                        $subscription_target = '';
                        if ($row['topic_type'] == TITANIA_QUEUE_DISCUSSION) {
                            $subscription_target = phpbb::$user->lang['SUBSCRIPTION_QUEUE_VALIDATION'];
                        }
                        if ($row['topic_type'] == TITANIA_QUEUE) {
                            $subscription_target = phpbb::$user->lang['SUBSCRIPTION_QUEUE'];
                        }
                        if ($row['topic_type'] == TITANIA_SUPPORT) {
                            $subscription_target = phpbb::$user->lang['SUBSCRIPTION_SUPPORT_TOPIC'];
                        }
                        // Tracking check
                        $last_read_mark = titania_tracking::get_track(TITANIA_TOPIC, $topic->topic_id, true);
                        $last_read_mark = max($last_read_mark, titania_tracking::find_last_read_mark($topic->additional_unread_fields, $topic->topic_type, $topic->parent_id));
                        $topic->unread = $topic->topic_last_post_time > $last_read_mark ? true : false;
                        // Get the folder image
                        $topic->topic_folder_img($folder_img, $folder_alt);
                        $vars = array('LAST_POST_IMG' => phpbb::$user->img('icon_topic_latest', 'VIEW_LATEST_POST'), 'SUBSCRIPTION_AUTHOR_FULL' => users_overlord::get_user($row['topic_first_post_user_id'], '_full'), 'SUBSCRIPTION_ID' => $row['topic_id'], 'SUBSCRIPTION_LAST_AUTHOR_FULL' => users_overlord::get_user($row['topic_last_post_user_id'], '_full'), 'SUBSCRIPTION_LAST_TIME' => phpbb::$user->format_date($row['topic_last_post_time']), 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['topic_time']), 'SUBSCRIPTION_TARGET' => $subscription_target, 'SUBSCRIPTION_TITLE' => censor_text($row['topic_subject']), 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'U_VIEW_SUBSCRIPTION' => $topic->get_url(), 'U_VIEW_LAST_POST' => titania_url::append_url($topic->get_url(), array('p' => $topic->topic_last_post_id, '#p' => $topic->topic_last_post_id)), 'S_ACCESS_TEAMS' => $row['topic_access'] == TITANIA_ACCESS_TEAMS || $row['topic_type'] == TITANIA_QUEUE ? true : false, 'S_ACCESS_AUTHORS' => $row['topic_access'] == TITANIA_ACCESS_AUTHORS ? true : false, 'S_TOPIC' => true);
                    } else {
                        if ($row['watch_object_type'] == TITANIA_CONTRIB) {
                            $tpl_block = 'items';
                            $contrib = new titania_contribution();
                            $contrib->__set_array($row);
                            titania_topic_folder_img($folder_img, $folder_alt, 0, titania_tracking::is_unread(TITANIA_CONTRIB, $contrib->contrib_id, $contrib->contrib_last_update));
                            $vars = array('SUBSCRIPTION_AUTHOR_FULL' => users_overlord::get_user($row['contrib_user_id'], '_full'), 'SUBSCRIPTION_CONTRIB_TYPE' => titania_types::$types[$contrib->contrib_type]->lang, 'SUBSCRIPTION_DOWNLOADS' => $row['contrib_downloads'], 'SUBSCRIPTION_ID' => $row['contrib_id'], 'SUBSCRIPTION_TARGET' => phpbb::$user->lang['SUBSCRIPTION_CONTRIB'], 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['contrib_last_update']), 'SUBSCRIPTION_TITLE' => $row['contrib_name'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'SUBSCRIPTION_VIEWS' => $row['contrib_views'], 'U_VIEW_SUBSCRIPTION' => $contrib->get_url(), 'S_CONTRIB' => true);
                        }
                    }
                    phpbb::$template->assign_block_vars($tpl_block, array_merge($vars, array('FOLDER_IMG' => phpbb::$user->img($folder_img, $folder_alt), 'FOLDER_IMG_SRC' => phpbb::$user->img($folder_img, $folder_alt, false, '', 'src'), 'FOLDER_IMG_ALT' => phpbb::$user->lang[$folder_alt], 'FOLDER_IMG_WIDTH' => phpbb::$user->img($folder_img, '', false, '', 'width'), 'FOLDER_IMG_HEIGHT' => phpbb::$user->img($folder_img, '', false, '', 'height'))));
                }
                break;
            case 'subscription_sections':
                $array_items = array(TITANIA_SUPPORT, TITANIA_QUEUE, TITANIA_ATTENTION);
                // We prepare pagination stuff
                $sql = 'SELECT COUNT(*) AS subscription_count
					FROM ' . TITANIA_WATCH_TABLE . '
					WHERE ' . phpbb::$db->sql_in_set('watch_object_type', $array_items) . '
					AND watch_user_id = ' . phpbb::$user->data['user_id'];
                phpbb::$db->sql_query($sql);
                $subscription_count = phpbb::$db->sql_fetchfield('subscription_count');
                phpbb::$db->sql_freeresult();
                $sort->total = $subscription_count;
                $sort->build_pagination($url);
                $sql_ary = array('SELECT' => '*,
						CASE w.watch_object_type
							WHEN ' . TITANIA_SUPPORT . ' THEN c.contrib_last_update
						END AS time', 'FROM' => array(TITANIA_WATCH_TABLE => 'w'), 'LEFT_JOIN' => array(array('FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'), 'ON' => '(w.watch_object_type = ' . TITANIA_SUPPORT . ')
								AND c.contrib_id = w.watch_object_id')), 'WHERE' => 'w.watch_user_id = ' . phpbb::$user->data['user_id'] . '
						AND ' . phpbb::$db->sql_in_set('watch_object_type', $array_items), 'ORDER_BY' => 'time DESC');
                $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
                // Get the data
                $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start);
                $user_ids = array();
                while ($row = phpbb::$db->sql_fetchrow($result)) {
                    $rows[] = $row;
                    $user_ids[] = $row['contrib_user_id'];
                }
                phpbb::$db->sql_freeresult($result);
                // Get user data
                users_overlord::load_users($user_ids);
                if (isset($rows)) {
                    foreach ($rows as $row) {
                        if ($row['watch_object_type'] == TITANIA_SUPPORT) {
                            $tpl_block = 'sections';
                            $contrib = new titania_contribution();
                            $contrib->__set_array($row);
                            $vars = array('SUBSCRIPTION_AUTHOR_FULL' => users_overlord::get_user($row['contrib_user_id'], '_full'), 'SUBSCRIPTION_ID' => $row['watch_object_id'], 'SUBSCRIPTION_TARGET' => phpbb::$user->lang['SUBSCRIPTION_SUPPORT'], 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['contrib_last_update']), 'SUBSCRIPTION_TITLE' => $row['contrib_name'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'U_VIEW_SUBSCRIPTION' => $contrib->get_url('support'));
                        } else {
                            if ($row['watch_object_type'] == TITANIA_ATTENTION) {
                                $tpl_block = 'sections';
                                $vars = array('SUBSCRIPTION_ID' => $row['watch_object_id'], 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['watch_mark_time']), 'SUBSCRIPTION_TITLE' => phpbb::$user->lang['SUBSCRIPTION_ATTENTION'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'S_ATTENTION' => true, 'S_ACCESS_TEAMS' => true, 'U_VIEW_SUBSCRIPTION' => titania_url::build_url('manage/attention'));
                            } else {
                                if ($row['watch_object_type'] == TITANIA_QUEUE) {
                                    $tpl_block = 'sections';
                                    $queue_id = $row['watch_object_id'];
                                    // Setup the base url we will use
                                    $base_url = titania_url::build_url('manage/queue');
                                    $vars = array('SUBSCRIPTION_ID' => $queue_id, 'SUBSCRIPTION_TARGET' => titania_types::$types[$queue_id]->lang, 'SUBSCRIPTION_TIME' => phpbb::$user->format_date($row['watch_mark_time']), 'SUBSCRIPTION_TITLE' => phpbb::$user->lang['SUBSCRIPTION_QUEUE'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'S_QUEUE' => true, 'S_ACCESS_TEAMS' => true, 'U_VIEW_SUBSCRIPTION' => titania_url::append_url($base_url, array('queue' => titania_types::$types[$queue_id]->url)));
                                }
                            }
                        }
                        phpbb::$template->assign_block_vars($tpl_block, $vars);
                    }
                }
                break;
        }
        phpbb::$template->assign_vars(array('S_ACTION' => $url, 'TITANIA_THEME_PATH' => titania::$absolute_path . 'styles/' . titania::$config->style . '/theme/'));
        titania::page_header(phpbb::$user->lang['SUBSCRIPTION_TITANIA']);
        titania::page_footer(true, 'manage/' . $mode . '.html');
    }
예제 #4
0
 /**
  * Set version check info for composer.json
  *
  * @param array $data						composer.json data
  * @param \titania_contribution $contrib
  * @return array Returns $data array with version check info set
  */
 protected function set_version_check(array $data, \titania_contribution $contrib)
 {
     $data['extra'] = isset($data['extra']) && is_array($data['extra']) ? $data['extra'] : array();
     unset($data['extra']['version_check']);
     $version_check_url = $contrib->get_url('version_check');
     $parts = parse_url($version_check_url);
     if ($parts !== false) {
         $directory = substr($parts['path'], 0, strrpos($parts['path'], '/'));
         $data['extra']['version-check'] = array('host' => $parts['host'], 'directory' => $directory, 'filename' => substr($parts['path'], strlen($directory) + 1));
     }
     return $data;
 }
예제 #5
0
 /**
  * Approve this revision
  *
  * @param mixed $public_notes
  */
 public function approve($public_notes)
 {
     $this->user->add_lang_ext('phpbb/titania', array('manage', 'contributions'));
     $revision = $this->get_revision();
     $contrib = new titania_contribution();
     if (!$contrib->load($this->contrib_id) || !$contrib->is_visible()) {
         return false;
     }
     $revision->contrib = $contrib;
     $revision->load_phpbb_versions();
     $branch = (int) $revision->phpbb_versions[0]['phpbb_version_branch'];
     $contrib_release_topic_id = $contrib->get_release_topic_id($branch);
     $notes = $this->validation_notes;
     message::decode($notes, $this->validation_notes_uid);
     $message = sprintf(phpbb::$user->lang['QUEUE_REPLY_APPROVED'], $revision->revision_version, $notes);
     // Replace empty quotes if there are no notes
     if (!$notes) {
         $message = str_replace('[quote][/quote]', '', $message);
     }
     $this->topic_reply($message, false);
     $this->discussion_reply($message);
     // Update the revisions
     $revision->change_status(TITANIA_REVISION_APPROVED);
     $revision->submit();
     // Reply to the release topic
     if ($contrib_release_topic_id && $contrib->type->update_public) {
         // Replying to an already existing topic, use the update message
         $public_notes = sprintf(phpbb::$user->lang[$contrib->type->update_public], $revision->revision_version) . ($public_notes ? sprintf(phpbb::$user->lang[$contrib->type->update_public . '_NOTES'], $public_notes) : '');
         $contrib->reply_release_topic($branch, $public_notes);
     } elseif (!$contrib_release_topic_id && $contrib->type->reply_public) {
         // Replying to a topic that was just made, use the reply message
         $public_notes = phpbb::$user->lang[$contrib->type->reply_public] . ($public_notes ? sprintf(phpbb::$user->lang[$contrib->type->reply_public . '_NOTES'], $public_notes) : '');
         $contrib->reply_release_topic($branch, $public_notes);
     }
     // Self-updating
     $this->queue_status = TITANIA_QUEUE_APPROVED;
     $this->queue_close_time = titania::$time;
     $this->queue_close_user = phpbb::$user->data['user_id'];
     $this->submit(false);
     // Send notification message
     $this->send_approve_deny_notification(true);
     // Subscriptions
     $email_vars = array('NAME' => $contrib->contrib_name, 'U_VIEW' => $contrib->get_url());
     $this->subscriptions->send_notifications(TITANIA_CONTRIB, $this->contrib_id, 'subscribe_notify', $email_vars);
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
 }
예제 #6
0
 /**
  * Display "forum" like section for support/tracker/etc
  *
  * @param string $type The type (support, review, queue, tracker, author_support, author_tracker) author_ for displaying posts from the areas the given author is involved in (either an author/co-author)
  * @param object|boolean $object The object (for contrib related (support, review, queue, tracker) and author_ modes)
  * @param object|boolean $sort The sort object (includes/tools/sort.php)
  * @param array $options Some special options
  * @param string $contrib_type The type of the support topic list
  */
 public static function display_forums($type, $object = false, $sort = false, $options = array())
 {
     if ($sort === false) {
         // Setup the sort tool
         $sort = self::build_sort();
     }
     $sort->request();
     $topic_ids = array();
     $switch_on_sticky = true;
     // Display the extra block after stickies end?  Not used when not sorting with stickies first
     $sql_ary = array('SELECT' => 't.*, 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_TOPICS_TABLE => 't'), 'WHERE' => self::sql_permissions('t.', false, true), 'ORDER_BY' => 't.topic_sticky DESC, ' . $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');
     // Setup the contribution/topic we will use for parsing the output (before the switch so we are able to do type specific things for it)
     $topic = new titania_topic();
     $contrib = new titania_contribution();
     // type specific things
     switch ($type) {
         case 'tracker':
             $page_url = $object->get_url('tracker');
             $sql_ary['WHERE'] .= ' AND t.parent_id = ' . (int) $object->contrib_id;
             $sql_ary['WHERE'] .= ' AND t.topic_type = ' . TITANIA_TRACKER;
             if (isset($options['category'])) {
                 $sql_ary['WHERE'] .= ' AND t.topic_category = ' . (int) $options['category'];
             }
             break;
         case 'queue':
             $page_url = titania_url::build_url('manage/queue');
             $sql_ary['WHERE'] .= ' AND t.topic_type = ' . TITANIA_QUEUE;
             break;
         case 'queue_discussion':
             $page_url = titania_url::build_url('manage/queue_discussion', array('queue' => titania_types::$types[$options['topic_category']]->url));
             $sql_ary['WHERE'] .= ' AND t.topic_type = ' . TITANIA_QUEUE_DISCUSSION;
             // Only display those in which the users are authed
             $authed = titania_types::find_authed('queue_discussion');
             if (!sizeof($authed)) {
                 return compact('sort');
             }
             if (isset($options['topic_category'])) {
                 if (!in_array((int) $options['topic_category'], $authed)) {
                     return compact('sort');
                 }
                 $sql_ary['WHERE'] .= ' AND t.topic_category = ' . (int) $options['topic_category'];
             } else {
                 $sql_ary['WHERE'] .= ' AND ' . phpbb::$db->sql_in_set('t.topic_category', $authed);
             }
             // Additional tracking for all queue discussion topics
             titania_tracking::get_track_sql($sql_ary, TITANIA_QUEUE_DISCUSSION, 0, 'tqt');
             $topic->additional_unread_fields[] = array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true);
             // Additional tracking for marking items as read in each contribution
             titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 't.parent_id', 'tst');
             $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'parent_match' => true);
             break;
         case 'author_support':
             $page_url = $object->get_url('support');
             $contrib_ids = titania::$cache->get_author_contribs($object->user_id, true);
             $sql_ary['WHERE'] .= ' AND ' . phpbb::$db->sql_in_set('t.parent_id', array_map('intval', $contrib_ids));
             // We also display the queue discussion topic between validators and authors in the support area
             $sql_ary['WHERE'] .= ' AND (t.topic_type = ' . TITANIA_SUPPORT . ' OR t.topic_type = ' . TITANIA_QUEUE_DISCUSSION . ')';
             // Additional tracking for marking items as read in each contribution
             titania_tracking::get_tracks(TITANIA_SUPPORT, $contrib_ids);
             $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'parent_match' => true);
             // Additional tracking for all support topics
             titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 0, 'tstg');
             $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'id' => 0, 'type_match' => true);
             // Track the queue discussion too if applicable
             if (titania_types::find_authed('queue_discussion')) {
                 titania_tracking::get_track_sql($sql_ary, TITANIA_QUEUE_DISCUSSION, 0, 'tqt');
                 $topic->additional_unread_fields[] = array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true);
             }
             // Try to grab the category/contrib name
             $sql_ary['SELECT'] .= ', contrib.contrib_name, contrib.contrib_name_clean, contrib.contrib_id, contrib.contrib_type';
             $sql_ary['LEFT_JOIN'] = array_merge(isset($sql_ary['LEFT_JOIN']) ? $sql_ary['LEFT_JOIN'] : array(), array(array('FROM' => array(TITANIA_CONTRIBS_TABLE => 'contrib'), 'ON' => 'contrib.contrib_id = t.parent_id')));
             // Do not order stickies first
             $sql_ary['ORDER_BY'] = $sort->get_order_by();
             $switch_on_sticky = false;
             break;
         case 'author_tracker':
             $page_url = $object->get_url('tracker');
             $contrib_ids = titania::$cache->get_author_contribs($object->user_id);
             $sql_ary['WHERE'] .= ' AND ' . phpbb::$db->sql_in_set('t.parent_id', array_map('intval', $contrib_ids));
             $sql_ary['WHERE'] .= ' AND t.topic_type = ' . TITANIA_TRACKER;
             break;
         case 'all_support':
             // Try to grab the category/contrib name
             $sql_ary['SELECT'] .= ', contrib.contrib_name, contrib.contrib_name_clean, contrib.contrib_id, contrib.contrib_type';
             $sql_ary['LEFT_JOIN'] = array_merge(isset($sql_ary['LEFT_JOIN']) ? $sql_ary['LEFT_JOIN'] : array(), array(array('FROM' => array(TITANIA_CONTRIBS_TABLE => 'contrib'), 'ON' => 'contrib.contrib_id = t.parent_id')));
             if (isset(titania_types::$types[$options['contrib_type']])) {
                 $page_url = titania_url::build_url('support/' . titania_types::$types[$options['contrib_type']]->url);
                 $sql_ary['WHERE'] .= ' AND contrib.contrib_type = ' . $options['contrib_type'];
             } else {
                 $page_url = titania_url::build_url('support/all');
             }
             // Additional tracking field (to allow marking all support/discussion as read)
             $sql_ary['WHERE'] .= ' AND t.topic_type = ' . TITANIA_SUPPORT;
             // Additional tracking for all support topics
             titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 0, 'tstg');
             $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'id' => 0);
             // Do not order stickies first
             $sql_ary['ORDER_BY'] = $sort->get_order_by();
             $switch_on_sticky = false;
             break;
         case 'support':
         default:
             $page_url = $object->get_url('support');
             $sql_ary['WHERE'] .= ' AND t.parent_id = ' . (int) $object->contrib_id;
             // We also display the queue discussion topic between validators and authors in the support area
             if ($object->is_author || $object->is_active_coauthor || titania_types::$types[$object->contrib_type]->acl_get('queue_discussion')) {
                 $sql_ary['WHERE'] .= ' AND (t.topic_type = ' . TITANIA_SUPPORT . ' OR t.topic_type = ' . TITANIA_QUEUE_DISCUSSION . ')';
             } else {
                 $sql_ary['WHERE'] .= ' AND t.topic_type = ' . TITANIA_SUPPORT;
             }
             // Additional tracking for marking items as read in each contribution
             titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, $object->contrib_id, 'tst');
             $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'parent_match' => true);
             // Additional tracking for all support topics
             titania_tracking::get_track_sql($sql_ary, TITANIA_SUPPORT, 0, 'tstg');
             $topic->additional_unread_fields[] = array('type' => TITANIA_SUPPORT, 'id' => 0);
             // Track the queue discussion too if applicable
             if (titania_types::$types[$object->contrib_type]->acl_get('queue_discussion')) {
                 titania_tracking::get_track_sql($sql_ary, TITANIA_QUEUE_DISCUSSION, 0, 'tqt');
                 $topic->additional_unread_fields[] = array('type' => TITANIA_QUEUE_DISCUSSION, 'id' => 0, 'type_match' => true);
             }
             break;
     }
     // Main SQL Query
     $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
     // Handle pagination
     if (!$sort->sql_count($sql_ary, 't.topic_id')) {
         // No results...no need to query more...
         return compact('sort');
     }
     $sort->build_pagination($page_url);
     $last_was_sticky = false;
     // 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);
         self::$topics[$row['topic_id']] = $row;
         $topic->__set_array($row);
         $contrib->__set_array($row);
         phpbb::$template->assign_block_vars('topics', array_merge($topic->assign_details(), array('S_TOPIC_TYPE_SWITCH' => $switch_on_sticky && $last_was_sticky && !$topic->topic_sticky ? true : false, 'CONTRIB_TYPE' => isset($row['contrib_type']) && $row['contrib_type'] ? titania_types::$types[$row['contrib_type']]->lang : '', 'TOPIC_CONTRIB_NAME' => isset($row['contrib_name']) && $row['contrib_name'] ? censor_text($row['contrib_name']) : '', 'U_VIEW_TOPIC_CONTRIB' => isset($row['contrib_type']) && $row['contrib_type'] ? $contrib->get_url() : '', 'U_VIEW_TOPIC_CONTRIB_SUPPORT' => isset($row['contrib_type']) && $row['contrib_type'] ? $contrib->get_url('support') : '')));
         $last_was_sticky = $topic->topic_sticky;
     }
     phpbb::$db->sql_freeresult($result);
     unset($topic);
     return compact('sort');
 }
예제 #7
0
            phpbb::$template->assign_vars(array('POST_SUBJECT' => censor_text($post->post_subject), 'POST_DATE' => phpbb::$user->format_date($post->post_time), 'POST_TEXT' => $post->generate_text_for_display(), 'EDITED_MESSAGE' => $post->post_edited ? sprintf(phpbb::$user->lang['EDITED_MESSAGE'], users_overlord::get_user($post->post_edit_user, '_full'), phpbb::$user->format_date($post->post_edited)) : '', 'DELETED_MESSAGE' => $post->post_deleted != 0 ? sprintf(phpbb::$user->lang['DELETED_MESSAGE'], users_overlord::get_user($post->post_delete_user, '_full'), phpbb::$user->format_date($post->post_deleted), $post->get_url('undelete')) : '', 'POST_EDIT_REASON' => censor_text($post->post_edit_reason), 'U_VIEW' => $post->get_url(), 'U_EDIT' => $post->get_url('edit'), 'SECTION_NAME' => '<a href="' . $post->get_url() . '">' . censor_text($post->post_subject) . '</a> - ' . phpbb::$user->lang['ATTENTION']));
            $title = censor_text($post->post_subject);
            break;
        case TITANIA_CONTRIB:
            $contrib = new titania_contribution();
            if (!$contrib->load((int) $object_id)) {
                $attention_object->delete();
                trigger_error('NO_CONTRIB');
            }
            // Close the report
            if ($close) {
                redirect(titania_url::build_url(titania_url::$current_page));
            }
            users_overlord::load_users(array($contrib->contrib_user_id));
            users_overlord::assign_details($contrib->contrib_user_id, 'POSTER_', true);
            phpbb::$template->assign_vars(array('POST_SUBJECT' => censor_text($contrib->contrib_name), 'POST_DATE' => phpbb::$user->format_date($contrib->contrib_last_update), 'POST_TEXT' => $contrib->generate_text_for_display(), 'U_VIEW' => $contrib->get_url(), 'U_EDIT' => $contrib->get_url('manage'), 'SECTION_NAME' => '<a href="' . $contrib->get_url() . '">' . censor_text($contrib->contrib_name) . '</a>  - ' . phpbb::$user->lang['ATTENTION']));
            $title = censor_text($contrib->contrib_name);
            break;
        default:
            trigger_error('NO_ATTENTION_TYPE');
            break;
    }
    titania::page_header($title . ' - ' . phpbb::$user->lang['ATTENTION']);
    titania::page_footer(true, 'manage/attention_details.html');
} else {
    $type = request_var('type', '');
    if (isset($_POST['sort'])) {
        $closed = isset($_POST['closed']) ? true : false;
        $open = isset($_POST['open']) || !$closed ? true : false;
        if ($open && $closed) {
            titania_url::$params['open'] = 1;
예제 #8
0
    /**
     * Display a single queue item
     *
     * @param int $queue_id
     * @return array('row' => (sql selection), 'contrib' => $contrib, 'topic' => $topic)
     */
    public static function display_queue_item($queue_id)
    {
        titania::add_lang('contributions');
        $sql_ary = array('SELECT' => '*', 'FROM' => array(TITANIA_QUEUE_TABLE => 'q', TITANIA_REVISIONS_TABLE => 'r', TITANIA_TOPICS_TABLE => 't'), 'WHERE' => 'q.queue_id = ' . (int) $queue_id . '
				AND r.revision_id = q.revision_id
				AND t.topic_id = q.queue_topic_id');
        // Main SQL Query
        $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
        $result = phpbb::$db->sql_query($sql);
        $row = phpbb::$db->sql_fetchrow($result);
        phpbb::$db->sql_freeresult($result);
        if (!$row) {
            trigger_error('NO_QUEUE_ITEM');
        }
        self::$queue[$queue_id] = $row;
        // Load the contribution
        $contrib = new titania_contribution();
        $contrib->load((int) $row['contrib_id']);
        $contrib->get_download($row['revision_id']);
        $contrib->get_revisions();
        $contrib->get_screenshots();
        $contrib->assign_details();
        // Load the topic (with the already selected data)
        $topic = new titania_topic();
        $topic->__set_array($row);
        // Bit of a hack for the posting
        $_REQUEST['t'] = $topic->topic_id;
        // Some quick-actions
        $quick_actions = array();
        if ($row['queue_status'] > 0) {
            if ($row['queue_progress'] == phpbb::$user->data['user_id']) {
                $quick_actions['MARK_NO_PROGRESS'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'no_progress')), 'class' => 'queue_progress');
            } else {
                if (!$row['queue_progress']) {
                    $quick_actions['MARK_IN_PROGRESS'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'in_progress')), 'class' => 'queue_progress');
                }
            }
            $tags = titania::$cache->get_tags(TITANIA_QUEUE);
            unset($tags[$row['queue_status']]);
            $quick_actions['CHANGE_STATUS'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'move')), 'class' => 'change_status', 'tags' => $tags);
            if (titania_types::$types[$contrib->contrib_type]->acl_get('moderate')) {
                $quick_actions['REPACK'] = array('url' => titania_url::append_url($contrib->get_url('revision'), array('repack' => $row['revision_id'])), 'class' => 'repack');
            }
            // This allows you to alter the author submitted notes to the validation team, not really useful as the field's purpose was changed, so commenting out
            /*$quick_actions['ALTER_NOTES'] = array(
            			'url'		=> titania_url::append_url(titania_url::$current_page_url, array('action' => 'notes')),
            		);*/
            // Misc actions
            $subactions = array();
            if (titania_types::$types[$contrib->contrib_type]->mpv_test) {
                $subactions['RETEST_MPV'] = array('url' => titania_url::build_url('', array('action' => 'mpv', 'revision' => $row['revision_id'])));
            }
            if (titania_types::$types[$contrib->contrib_type]->automod_test) {
                $subactions['RETEST_AUTOMOD'] = array('url' => titania_url::build_url('', array('action' => 'automod', 'revision' => $row['revision_id'])));
            }
            $subactions['REBUILD_FIRST_POST'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'rebuild')));
            $quick_actions['CAT_MISC'] = array('subactions' => $subactions, 'class' => 'misc');
            // Validation
            if (titania_types::$types[$contrib->contrib_type]->acl_get('validate')) {
                $quick_actions['APPROVE'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'approve', 'start' => '*destroy*')), 'class' => 'approve');
                $quick_actions['DENY'] = array('url' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'deny', 'start' => '*destroy*')), 'class' => 'deny');
            }
        }
        foreach ($quick_actions as $lang_key => $data) {
            phpbb::$template->assign_block_vars('queue_actions', array('NAME' => isset(phpbb::$user->lang[$lang_key]) ? phpbb::$user->lang[$lang_key] : $lang_key, 'CLASS' => isset($data['class']) ? $data['class'] : '', 'U_VIEW' => isset($data['url']) ? $data['url'] : ''));
            if (isset($data['tags'])) {
                foreach ($data['tags'] as $tag_id => $tag_row) {
                    phpbb::$template->assign_block_vars('queue_actions.subactions', array('ID' => $tag_id, 'NAME' => isset(phpbb::$user->lang[$tag_row['tag_field_name']]) ? phpbb::$user->lang[$tag_row['tag_field_name']] : $tag_row['tag_field_name'], 'U_ACTION' => titania_url::append_url($data['url'], array('id' => $tag_id, 'hash' => generate_link_hash('quick_actions')))));
                }
            }
            if (isset($data['subactions'])) {
                foreach ($data['subactions'] as $sublang_key => $subdata) {
                    phpbb::$template->assign_block_vars('queue_actions.subactions', array('NAME' => isset(phpbb::$user->lang[$sublang_key]) ? phpbb::$user->lang[$sublang_key] : $sublang_key, 'U_ACTION' => $subdata['url']));
                }
            }
        }
        if ($row['queue_status'] == -2) {
            $current_status = phpbb::$user->lang['REVISION_DENIED'];
        } else {
            if ($row['queue_status'] == -1) {
                $current_status = phpbb::$user->lang['REVISION_APPROVED'];
            } else {
                $current_status = titania_tags::get_tag_name($row['queue_status']);
            }
        }
        phpbb::$template->assign_vars(array('CURRENT_STATUS' => $current_status, 'S_DISPLAY_CONTRIBUTION' => true, 'S_IN_QUEUE' => true, 'U_POST_REPLY' => titania_url::append_url(titania_url::$current_page_url, array('action' => 'reply', 't' => $topic->topic_id)), 'U_NEW_REVISION' => false));
        // Subscriptions
        titania_subscriptions::handle_subscriptions(TITANIA_TOPIC, $topic->topic_id, titania_url::$current_page_url);
        return compact('row', 'contrib', 'topic');
    }
예제 #9
0
 $value = request_var('value', -1.0);
 switch ($type) {
     case 'author':
         $object = new titania_author();
         $object->load($id);
         $object->get_rating();
         $redirect = $object->get_url();
         if (!$object || !$object->author_id) {
             trigger_error('AUTHOR_NOT_FOUND');
         }
         break;
     case 'contrib':
         $object = new titania_contribution();
         $object->load($id);
         $object->get_rating();
         $redirect = $object->get_url();
         if (!$object) {
             trigger_error('CONTRIB_NOT_FOUND');
         }
         break;
     default:
         trigger_error('BAD_RATING');
         break;
 }
 $result = $value == -1 ? $object->rating->delete_rating() : $object->rating->add_rating($value);
 if ($result) {
     redirect($redirect);
 } else {
     trigger_error('BAD_RATING');
 }
 break;
예제 #10
0
    /**
     * Display a single queue item
     *
     * @param int $queue_id
     * @return array('row' => (sql selection), 'contrib' => $contrib, 'topic' => $topic)
     */
    public static function display_queue_item($queue_id)
    {
        phpbb::$user->add_lang_ext('phpbb/titania', 'contributions');
        $controller_helper = phpbb::$container->get('phpbb.titania.controller.helper');
        $path_helper = phpbb::$container->get('path_helper');
        $sql_ary = array('SELECT' => '*', 'FROM' => array(TITANIA_QUEUE_TABLE => 'q', TITANIA_REVISIONS_TABLE => 'r', TITANIA_TOPICS_TABLE => 't'), 'WHERE' => 'q.queue_id = ' . (int) $queue_id . '
				AND r.revision_id = q.revision_id
				AND t.topic_id = q.queue_topic_id');
        // Main SQL Query
        $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
        $result = phpbb::$db->sql_query($sql);
        $row = phpbb::$db->sql_fetchrow($result);
        phpbb::$db->sql_freeresult($result);
        if (!$row) {
            trigger_error('NO_QUEUE_ITEM');
        }
        self::$queue[$queue_id] = $row;
        $queue = self::get_queue_object($queue_id);
        // Load the contribution
        $contrib = new titania_contribution();
        $contrib->load((int) $row['contrib_id']);
        $contrib->get_download($row['revision_id']);
        $contrib->get_revisions();
        $contrib->get_screenshots();
        $contrib->assign_details();
        // Load the topic (with the already selected data)
        $topic = new titania_topic();
        $topic->__set_array($row);
        // Bit of a hack for the posting
        phpbb::$request->overwrite('t', $topic->topic_id);
        $is_moderator = $contrib->type->acl_get('moderate');
        $is_validator = $contrib->type->acl_get('validate');
        $hash = array('hash' => generate_link_hash('queue_tool'));
        // Misc actions
        $misc_actions = array(array('RETEST_PV', $queue->get_tool_url('mpv', $row['revision_id'], $hash), $contrib->type->mpv_test), array('RETEST_PV', $queue->get_tool_url('epv', $row['revision_id'], $hash), $contrib->type->epv_test), array('RETEST_AUTOMOD', $queue->get_tool_url('automod', $row['revision_id'], $hash), $contrib->type->automod_test));
        // Some quick-actions
        $quick_actions = array();
        $hash = array('hash' => generate_link_hash('queue_action'));
        if ($row['queue_status'] > 0) {
            $misc_actions = array_merge($misc_actions, array(array('REBUILD_FIRST_POST', $queue->get_url('rebuild', $hash), true), array('ALLOW_AUTHOR_REPACK', $queue->get_url('allow_author_repack'), $is_moderator && !$row['allow_author_repack']), array('MARK_TESTED', $queue->get_url('tested', $hash), !$row['queue_tested']), array('MARK_UNTESTED', $queue->get_url('not_tested', $hash), $row['queue_tested'])));
            $tags = titania::$cache->get_tags(TITANIA_QUEUE);
            unset($tags[$row['queue_status']]);
            $quick_actions = array(array('MARK_NO_PROGRESS', $queue->get_url('no_progress', $hash), $row['queue_progress'] == phpbb::$user->data['user_id'], 'queue_progress'), array('MARK_IN_PROGRESS', $queue->get_url('in_progress', $hash), !$row['queue_progress'], 'queue_progress'), array('CHANGE_STATUS', $queue->get_url('move'), true, 'change_status', $tags), array('REPACK', $contrib->get_url('revision', array('page' => 'repack', 'id' => $row['revision_id'])), $is_moderator, 'repack'), array('CAT_MISC', '', true, 'misc', '', $misc_actions), array('APPROVE', $queue->get_url('approve'), $is_validator, 'approve'), array('DENY', $queue->get_url('deny'), $is_validator, 'deny'));
        }
        if (empty($quick_actions) && !empty($misc_actions)) {
            $quick_actions = array(array('CAT_MISC', '', true, 'misc', '', $misc_actions));
        }
        foreach ($quick_actions as $data) {
            $properties = array('name', 'url', 'auth', 'class', 'tags', 'subactions');
            $data = array_pad($data, sizeof($properties), '');
            $data = array_combine($properties, $data);
            if (!$data['auth']) {
                continue;
            }
            phpbb::$template->assign_block_vars('queue_actions', array('NAME' => phpbb::$user->lang($data['name']), 'CLASS' => $data['class'], 'U_VIEW' => $data['url']));
            if ($data['tags']) {
                foreach ($data['tags'] as $tag_id => $tag_row) {
                    phpbb::$template->assign_block_vars('queue_actions.subactions', array('ID' => $tag_id, 'NAME' => phpbb::$user->lang($tag_row['tag_field_name']), 'U_ACTION' => $path_helper->append_url_params($data['url'], array('id' => $tag_id, 'hash' => generate_link_hash('quick_actions')))));
                }
            }
            if ($data['subactions']) {
                foreach ($data['subactions'] as $subdata) {
                    $subdata = array_pad($subdata, sizeof($properties), '');
                    $subdata = array_combine($properties, $subdata);
                    if (!$subdata['auth']) {
                        continue;
                    }
                    phpbb::$template->assign_block_vars('queue_actions.subactions', array('NAME' => phpbb::$user->lang($subdata['name']), 'U_ACTION' => $subdata['url']));
                }
            }
        }
        if ($row['queue_status'] == -3) {
            $current_status = phpbb::$user->lang('QUEUE_CLOSED');
        } else {
            if ($row['queue_status'] == -2) {
                $current_status = phpbb::$user->lang['REVISION_DENIED'];
            } else {
                if ($row['queue_status'] == -1) {
                    $current_status = phpbb::$user->lang['REVISION_APPROVED'];
                } else {
                    $current_status = phpbb::$container->get('phpbb.titania.tags')->get_tag_name($row['queue_status']);
                }
            }
        }
        phpbb::$template->assign_vars(array('CURRENT_STATUS' => $current_status, 'S_DISPLAY_CONTRIBUTION' => true, 'S_IN_QUEUE' => true, 'U_POST_REPLY' => $queue->get_url('reply'), 'U_NEW_REVISION' => false));
        // Subscriptions
        phpbb::$container->get('phpbb.titania.subscriptions')->handle_subscriptions(TITANIA_TOPIC, $topic->topic_id, $controller_helper->get_current_url(), 'SUBSCRIBE_TOPIC');
        return compact('row', 'contrib', 'topic');
    }
예제 #11
0
 /**
  * Assign variables to the template
  */
 public function assign_details()
 {
     if (!sizeof($this->styles)) {
         return false;
     }
     // Get siblings
     $prev = $this->sibling($this->default_style, 'prev');
     $next = $this->sibling($this->default_style, 'next');
     $this->template->assign_vars(array('U_PREV' => $prev['url'], 'PREV_ID' => $prev['id'], 'U_NEXT' => $next['url'], 'NEXT_ID' => $next['id']));
     $category = '';
     $style = new \titania_contribution();
     $style->set_type(TITANIA_TYPE_STYLE);
     $style->options = array('demo' => true);
     foreach ($this->styles as $id => $data) {
         $style->__set_array(array('contrib_id' => $id, 'contrib_name_clean' => $data['contrib_name_clean'], 'contrib_demo' => $data['contrib_demo']));
         $preview_img = false;
         if (isset($data['thumb_id'])) {
             $parameters = array('id' => $data['thumb_id']);
             if ($data['thumbnail']) {
                 $parameters += array('mode' => 'view', 'thumb' => 1);
             }
             $preview_img = $this->controller_helper->route('phpbb.titania.download', $parameters);
         }
         $authors = $this->get_author_profile(array('username_clean' => $data['username_clean'], 'username' => $data['username'], 'user_id' => $data['contrib_user_id'], 'user_colour' => $data['user_colour']));
         $authors .= $data['coauthors'];
         $data['category_name'] = $this->user->lang($data['category_name']);
         $phpbb_version = $data['phpbb_versions']['branch'][0] . '.' . $data['phpbb_versions']['branch'][1] . '.' . $data['phpbb_versions']['revision'];
         $current_phpbb_version = $data['phpbb_versions']['branch'][0] . '.' . $data['phpbb_versions']['branch'][1] . '.' . $this->ext_config->phpbb_versions[$data['phpbb_versions']['branch']]['latest_revision'];
         $vars = array('AUTHORS' => $authors, 'CATEGORY' => $category != $data['category_name'] ? $data['category_name'] : false, 'ID' => $id, 'IFRAME' => $style->get_demo_url($this->phpbb_branch), 'LICENSE' => $data['revision_license'] ? $data['revision_license'] : $this->user->lang['UNKNOWN'], 'NAME' => $data['contrib_name'], 'PHPBB_VERSION' => $phpbb_version, 'PREVIEW' => $preview_img, 'S_OUTDATED' => phpbb_version_compare($phpbb_version, $current_phpbb_version, '<'), 'U_DEMO' => $style->get_demo_url($this->phpbb_branch, true), 'U_DOWNLOAD' => $this->controller_helper->route('phpbb.titania.download', array('id' => $data['attachment_id'])), 'U_VIEW' => $style->get_url());
         if ($this->default_style == $id) {
             $this->template->assign_vars($vars);
         }
         $category = $data['category_name'];
         $this->template->assign_block_vars('stylerow', $vars);
         unset($this->styles[$id], $vars, $this->coauthors[$id]);
     }
 }