/** * Passes details to the template * * @param bool $return True if you want the data prepared for output and returned as an array, false to output to the template */ public function assign_details($return = false, $row = false, $revert = true) { // Set special data to display if ($row !== false) { if ($revert) { $backup = $this->object_data; } $this->__set_array($row); } $vars = array('AUTHOR_NAME_FULL' => $this->get_username_string(), 'AUTHOR_REALNAME' => $this->author_realname, 'AUTHOR_WEBSITE' => $this->get_website_url(), 'AUTHOR_WEBSITE_LINK' => '<a href="' . $this->get_website_url() . '">' . $this->get_website_url() . '</a>', 'AUTHOR_RATING' => $this->author_id ? $this->author_rating : '', 'AUTHOR_RATING_STRING' => $this->author_id && isset($this->rating) ? $this->rating->get_rating_string() : '', 'AUTHOR_RATING_COUNT' => $this->author_id ? $this->author_rating_count : '', 'AUTHOR_CONTRIBS' => $this->author_contribs, 'AUTHOR_DESC' => $this->generate_text_for_display(), 'U_AUTHOR_PROFILE' => $this->get_url(), 'U_AUTHOR_PROFILE_PHPBB' => $this->get_phpbb_profile_url(), 'U_AUTHOR_PROFILE_PHPBB_COM' => $this->get_phpbb_com_profile_url(), 'U_AUTHOR_CONTRIBUTIONS' => $this->get_url('contributions')); // Add to it the common user details if (isset(users_overlord::$users[$this->user_id])) { $vars = array_merge(users_overlord::assign_details($this->user_id), $vars); } // Output the count for different types $type_list = array(); foreach (titania_types::$types as $type) { if (!isset($type->author_count)) { // Figure out the counts some other way $sql_ary = array('SELECT' => 'COUNT(*) AS contrib_cnt, cat.category_name, cat.category_name_clean', 'FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'), 'LEFT_JOIN' => array(array('FROM' => array(TITANIA_CONTRIB_COAUTHORS_TABLE => 'ca'), 'ON' => 'ca.contrib_id = c.contrib_id'), array('FROM' => array(TITANIA_CATEGORIES_TABLE => 'cat'), 'ON' => 'cat.category_type = c.contrib_type')), 'WHERE' => "c.contrib_visible = 1 AND c.contrib_type = {$type->id} AND (c.contrib_user_id = {$this->user_id}\n\t\t\t\t\t\t\t\t\tOR ca.user_id = {$this->user_id})"); $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary); $result = phpbb::$db->sql_query($sql); $type_row = phpbb::$db->sql_fetchrow($result); phpbb::$db->sql_freeresult($result); $contrib_cnt = (int) $type_row['contrib_cnt']; $cat_name = $type_row['category_name']; $cat_name_clean = $type_row['category_name_clean']; if ($contrib_cnt > 0) { if ($contrib_cnt == 1) { $type_list[] = isset(phpbb::$user->langs['AUTHOR_' . strtoupper($cat_name_clean) . '_ONE']) ? phpbb::$user->lang['AUTHOR_' . strtoupper($cat_name_clean) . '_ONE'] : '1 ' . $cat_name; } else { $type_list[] = isset(phpbb::$user->lang['AUTHOR_' . strtoupper($cat_name_clean)]) ? sprintf(phpbb::$user->lang['AUTHOR_' . strtoupper($cat_name_clean)], $contrib_cnt) : $contrib_cnt . ' ' . $cat_name; } } continue; } if ($this->{$type->author_count} > 0) { if ($this->{$type->author_count} == 1) { $type_list[] = isset(phpbb::$user->lang[strtoupper($type->author_count) . '_ONE']) ? phpbb::$user->lang[strtoupper($type->author_count) . '_ONE'] : '{' . strtoupper($type->author_count) . '_ONE}'; } else { $type_list[] = isset(phpbb::$user->lang[strtoupper($type->author_count)]) ? sprintf(phpbb::$user->lang[strtoupper($type->author_count)], $this->{$type->author_count}) : '{' . strtoupper($type->author_count) . '}'; } } } $vars['AUTHOR_CONTRIB_LIST'] = implode($type_list, ', '); /* @todo: automatically display the common author data too... if (isset($this->sql_data)) { $vars = array_merge($vars, assign_user_details($this->sql_data)); }*/ // Revert data if ($revert && $row !== false) { $this->__set_array($backup); unset($backup); } if ($return) { return $vars; } phpbb::$template->assign_vars($vars); }
/** * Display the list of attention items * * @param array $options * attention_type * exclude_attention_types * attention_object_id * only_closed bool only display closed items * display_closed bool display closed and open items * template_block string the name of the template block to output to (attention if not sent) * @param \phpbb\titania\sort $sort */ public static function display_attention_list($options = array(), $sort = false) { if ($sort === false) { // Setup the sort tool $sort = self::build_sort(); } $sort->request(); $path_helper = phpbb::$container->get('path_helper'); $controller_helper = phpbb::$container->get('phpbb.titania.controller.helper'); $sql_ary = array('SELECT' => 'a.*', 'FROM' => array(TITANIA_ATTENTION_TABLE => 'a'), 'LEFT_JOIN' => array(array('FROM' => array(TITANIA_CONTRIBS_TABLE => 'c'), 'ON' => 'a.attention_object_type = ' . TITANIA_CONTRIB . ' AND a.attention_object_id = c.contrib_id')), 'WHERE' => array(), 'ORDER_BY' => $sort->get_order_by()); // Limit to certain types if requested if (isset($options['attention_type']) && $options['attention_type']) { $sql_ary['WHERE'][] = 'a.attention_type = ' . (int) $options['attention_type']; } // Exclude certain types if (!empty($options['exclude_attention_types'])) { $sql_ary['WHERE'][] = phpbb::$db->sql_in_set('a.attention_type', $options['exclude_attention_types'], true); } // Limit to certain item if requested if (isset($options['attention_object_id'])) { $sql_ary['WHERE'][] = 'a.attention_object_id = ' . (int) $options['attention_object_id']; } // Do we want the closed ones? if (isset($options['only_closed']) && $options['only_closed']) { $sql_ary['WHERE'][] = 'a.attention_close_time <> 0'; } else { if (!isset($options['display_closed']) || $options['display_closed'] == false) { $sql_ary['WHERE'][] = 'a.attention_close_time = 0'; } } $sql_ary['WHERE'][] = self::get_permission_sql(); $sql_ary['WHERE'] = implode(' AND ', $sql_ary['WHERE']); // Main SQL Query $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary); // Handle pagination if (!$sort->sql_count($sql_ary, 'a.attention_id')) { // No results...no need to query more... return; } $url_parts = $path_helper->get_url_parts($controller_helper->get_current_url()); $sort->build_pagination($url_parts['base'], $url_parts['params']); // Get the data $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start); $attention_ids = $user_ids = array(); while ($row = phpbb::$db->sql_fetchrow($result)) { $attention_ids[] = $row['attention_id']; $user_ids[] = $row['attention_poster_id']; $user_ids[] = $row['attention_requester']; $user_ids[] = $row['attention_close_user']; if ($row['attention_close_user']) { $user_ids[] = $row['attention_close_user']; } self::$attention_items[$row['attention_id']] = $row; } phpbb::$db->sql_freeresult($result); // Grab some users users_overlord::load_users($user_ids); // Output time foreach ($attention_ids as $attention_id) { $attention = self::get_attention_object($attention_id); $output = array_merge($attention->assign_details(true), users_overlord::assign_details($attention->attention_poster_id), users_overlord::assign_details($attention->attention_requester, 'REPORTER_'), users_overlord::assign_details($attention->attention_close_user, 'CLOSER_')); // Do we have to? if ($row['attention_close_user']) { $output = array_merge($output, users_overlord::assign_details($attention->attention_close_user, 'CLOSE_')); } $template_block = isset($options['template_block']) ? $options['template_block'] : 'attention'; phpbb::$template->assign_block_vars($template_block, $output); } unset($attention); }
/** * Passes details to the template * * @param bool $return True if you want the data prepared for output and returned as an array, false to output to the template */ public function assign_details($return = false, $row = false, $revert = true) { // Set special data to display if ($row !== false) { if ($revert) { $backup = $this->object_data; } $this->__set_array($row); } $vars = array('AUTHOR_NAME_FULL' => $this->get_username_string(), 'AUTHOR_REALNAME' => $this->author_realname, 'AUTHOR_WEBSITE' => $this->get_website_url(), 'AUTHOR_WEBSITE_LINK' => '<a href="' . $this->get_website_url() . '">' . $this->get_website_url() . '</a>', 'AUTHOR_RATING' => $this->author_id ? $this->author_rating : '', 'AUTHOR_RATING_STRING' => $this->author_id && isset($this->rating) ? $this->rating->get_rating_string() : '', 'AUTHOR_RATING_COUNT' => $this->author_id ? $this->author_rating_count : '', 'AUTHOR_CONTRIBS' => $this->author_contribs, 'AUTHOR_DESC' => $this->generate_text_for_display(), 'U_AUTHOR_PROFILE' => $this->get_url(), 'U_AUTHOR_PROFILE_PHPBB' => $this->get_phpbb_profile_url(), 'U_AUTHOR_PROFILE_PHPBB_COM' => $this->get_phpbb_com_profile_url(), 'U_AUTHOR_CONTRIBUTIONS' => $this->get_url('contributions')); // Add to it the common user details if (isset(users_overlord::$users[$this->user_id])) { $vars = array_merge(users_overlord::assign_details($this->user_id), $vars); } // Output the count for different types $type_list = array(); foreach (titania_types::$types as $type) { if (!isset($type->author_count)) { continue; } if ($this->{$type->author_count} == 1) { $type_list[] = isset(phpbb::$user->lang[strtoupper($type->author_count) . '_ONE']) ? phpbb::$user->lang[strtoupper($type->author_count) . '_ONE'] : '{' . strtoupper($type->author_count) . '_ONE}'; } else { $type_list[] = isset(phpbb::$user->lang[strtoupper($type->author_count)]) ? sprintf(phpbb::$user->lang[strtoupper($type->author_count)], $this->{$type->author_count}) : '{' . strtoupper($type->author_count) . '}'; } } $vars['AUTHOR_CONTRIB_LIST'] = implode($type_list, ', '); /* @todo: automatically display the common author data too... if (isset($this->sql_data)) { $vars = array_merge($vars, assign_user_details($this->sql_data)); }*/ // Revert data if ($revert && $row !== false) { $this->__set_array($backup); unset($backup); } if ($return) { return $vars; } phpbb::$template->assign_vars($vars); }
users_overlord::assign_details($post->post_user_id, 'POSTER_', true); 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) {
/** * Display topic section for support/tracker/etc * * @param object $topic The topic object * @param titania_sort $sort The sort object (includes/tools/sort.php) */ public static function display_topic($topic, $sort = false) { if ($sort === false) { // Setup the sort tool $sort = self::build_sort(); } $sort->request(); $sql_ary = array('SELECT' => 'p.*', 'FROM' => array(TITANIA_POSTS_TABLE => 'p'), 'WHERE' => 'p.topic_id = ' . (int) $topic->topic_id . self::sql_permissions('p.'), 'ORDER_BY' => $sort->get_order_by()); // Main SQL Query $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary); // Handle pagination if (!$sort->sql_count($sql_ary, 'p.post_id')) { // No results...no need to query more... return; } $sort->build_pagination($topic->get_url()); // Get the data $post_ids = $user_ids = array(); $last_post_time = 0; // tracking $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start); while ($row = phpbb::$db->sql_fetchrow($result)) { self::$posts[$row['post_id']] = $row; self::$posts[$row['post_id']]['attachments'] = array(); $post_ids[] = $row['post_id']; $user_ids[] = $row['post_user_id']; $user_ids[] = $row['post_edit_user']; $user_ids[] = $row['post_delete_user']; $last_post_time = $row['post_time']; // to set tracking } phpbb::$db->sql_freeresult($result); // Grab the tracking data $last_mark_time = titania_tracking::get_track(TITANIA_TOPIC, $topic->topic_id); // Store tracking data titania_tracking::track(TITANIA_TOPIC, $topic->topic_id, $last_post_time); // load the user data users_overlord::load($user_ids); phpbb::_include('functions_profile_fields', false, 'custom_profile'); $cp = new custom_profile(); $post = new titania_post($topic->topic_type, $topic); $attachments = new titania_attachment($topic->topic_type, false); // Grab all attachments $attachments_set = $attachments->load_attachments_set($post_ids); // Loop de loop $prev_post_time = 0; foreach ($post_ids as $post_id) { $post->__set_array(self::$posts[$post_id]); $attachments->clear_attachments(); if (isset($attachments_set[$post_id])) { $attachments->store_attachments($attachments_set[$post_id]); } // Parse attachments before outputting the message $message = $post->generate_text_for_display(); $parsed_attachments = $attachments->parse_attachments($message); // Prepare message text for use in javascript $message_decoded = censor_text($post->post_text); titania_decode_message($message_decoded, $post->post_text_uid); $message_decoded = bbcode_nl2br($message_decoded); // Build CP Fields $cp_row = array(); if (isset(users_overlord::$cp_fields[$post->post_user_id])) { $cp_row = $cp->generate_profile_fields_template('show', false, users_overlord::$cp_fields[$post->post_user_id]); } $cp_row['row'] = isset($cp_row['row']) && sizeof($cp_row['row']) ? $cp_row['row'] : array(); // Display edit info $display_username = get_username_string('full', $post->post_user_id, users_overlord::get_user($post->post_user_id, 'username'), users_overlord::get_user($post->post_user_id, 'user_colour'), false, phpbb::append_sid('memberlist', 'mode=viewprofile')); $l_edited_by = $post->post_edit_time ? sprintf(phpbb::$user->lang['EDITED_MESSAGE'], $display_username, phpbb::$user->format_date($post->post_edit_time)) : ''; phpbb::$template->assign_block_vars('posts', array_merge($post->assign_details(false), users_overlord::assign_details($post->post_user_id), $cp_row['row'], array('POST_TEXT' => $message, 'POST_TEXT_DECODED' => $message_decoded, 'EDITED_MESSAGE' => $l_edited_by, 'U_MINI_POST' => titania_url::append_url($topic->get_url(), array('p' => $post_id, '#p' => $post_id)), 'MINI_POST_IMG' => $post->post_time > $last_mark_time ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), 'S_FIRST_UNREAD' => $post->post_time > $last_mark_time && $prev_post_time <= $last_mark_time ? true : false))); // Output CP Fields if (!empty($cp_row['blockrow'])) { foreach ($cp_row['blockrow'] as $field_data) { phpbb::$template->assign_block_vars('posts.custom_fields', $field_data); } } //S_IGNORE_POST //POST_ICON_IMG //MINI_POST_IMG foreach ($parsed_attachments as $attachment) { phpbb::$template->assign_block_vars('posts.attachment', array('DISPLAY_ATTACHMENT' => $attachment)); } $prev_post_time = $post->post_time; } unset($post, $attachments); // Increment the topic view count $sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . ' SET topic_views = topic_views + 1 WHERE topic_id = ' . (int) $topic->topic_id; phpbb::$db->sql_query($sql); }
/** * Generate the stats page */ public function display_stats() { $stats = false; //titania::$cache->get('queue_stats'); if ($stats === false) { $stats = array(); foreach (titania_types::$types as $type_id => $class) { foreach (titania::$config->queue_stats_periods as $name => $data) { // Shorten $temp_stats = array(); // Select the stats for this type $sql = 'SELECT revision_id, contrib_id, queue_type, submitter_user_id, queue_submit_time, queue_close_time, queue_close_user FROM ' . TITANIA_QUEUE_TABLE . ' WHERE queue_type = ' . (int) $type_id . ' AND queue_close_time > 0 ' . (isset($data['where']) ? 'AND ' . $data['where'] : ''); $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { // List of submitters with totals $temp_stats['submitters'][$row['submitter_user_id']] = isset($temp_stats['submitters'][$row['submitter_user_id']]) ? $temp_stats['submitters'][$row['submitter_user_id']] + 1 : 1; // List of users who closed the queue items with totals $temp_stats['closers'][$row['queue_close_user']] = isset($temp_stats['closers'][$row['queue_close_user']]) ? $temp_stats['closers'][$row['queue_close_user']] + 1 : 1; // Count $temp_stats['total'] = isset($temp_stats['total']) ? $temp_stats['total'] + 1 : 1; // Total time in validation $temp_stats['total_validation_time'] = isset($temp_stats['total_validation_time']) ? $temp_stats['total_validation_time'] + ($row['queue_close_time'] - $row['queue_submit_time']) : $row['queue_close_time'] - $row['queue_submit_time']; } phpbb::$db->sql_freeresult($result); // Shorten $stats[$type_id][$name] = $temp_stats; } // Handle the data foreach (titania::$config->queue_stats_periods as $name => $data) { // Shorten $temp_stats = $stats[$type_id][$name]; // List of submitters with totals if (isset($temp_stats['submitters']) && sizeof($temp_stats['submitters'])) { arsort($temp_stats['submitters']); } // List of users who closed the queue items with totals if (isset($temp_stats['closers']) && sizeof($temp_stats['closers'])) { arsort($temp_stats['closers']); } // Average time in validation $temp_stats['average_validation_time'] = floor(isset($temp_stats['total_validation_time']) && $temp_stats['total_validation_time'] > 0 ? $temp_stats['total_validation_time'] / $temp_stats['total'] : 0); // Shorten $stats[$type_id][$name] = $temp_stats; } } titania::$cache->put('queue_stats', $stats, 60 * 60); } // Need to grab some user data $user_ids = array(); foreach (titania_types::$types as $type_id => $class) { foreach (titania::$config->queue_stats_periods as $name => $data) { // Shorten $temp_stats = $stats[$type_id][$name]; foreach (array('submitters', 'closers') as $type) { if (isset($temp_stats[$type]) && sizeof($temp_stats[$type])) { $i = 1; foreach ($temp_stats[$type] as $user_id => $cnt) { // Only grab the first 5 if ($i > 5) { break; } $i++; $user_ids[] = $user_id; } } } } } // Load the users users_overlord::load_users($user_ids); // Output foreach (titania_types::$types as $type_id => $class) { phpbb::$template->assign_block_vars('stats', array('TITLE' => $class->lang)); foreach (titania::$config->queue_stats_periods as $name => $data) { // Shorten $temp_stats = $stats[$type_id][$name]; $avg_num_weeks = $avg_num_days = 0; if ($temp_stats['average_validation_time'] > 0) { $avg_num_weeks = floor($temp_stats['average_validation_time'] / (60 * 60 * 24 * 7)); $avg_num_days = floor($temp_stats['average_validation_time'] / (60 * 60 * 24)) % 7; } phpbb::$template->assign_block_vars('stats.periods', array('TITLE' => isset(phpbb::$user->lang[$data['lang']]) ? phpbb::$user->lang[$data['lang']] : $data['lang'], 'AVERAGE_VALIDATION_TIME' => phpbb::$user->lang('NUM_WEEKS', $avg_num_weeks) . ' ' . phpbb::$user->lang('NUM_DAYS', $avg_num_days))); // Submitter/closer data foreach (array('submitters', 'closers') as $type) { if (isset($temp_stats[$type]) && sizeof($temp_stats[$type])) { $i = 1; foreach ($temp_stats[$type] as $user_id => $cnt) { // Only output the first 5 if ($i > 5) { break; } $i++; // Assign user details and total phpbb::$template->assign_block_vars('stats.periods.' . $type, array_merge(users_overlord::assign_details($user_id), array('TOTAL' => $cnt))); } } } } } }
/** * Display the list of attention items * * @param array $options * attention_type * attention_object_id * only_closed bool only display closed items * display_closed bool display closed and open items * template_block string the name of the template block to output to (attention if not sent) * @param titania_sort $sort */ public static function display_attention_list($options = array(), $sort = false) { if ($sort === false) { // Setup the sort tool $sort = self::build_sort(); } $sort->request(); $sql_ary = array('SELECT' => '*', 'FROM' => array(TITANIA_ATTENTION_TABLE => 'a'), 'WHERE' => array(), 'ORDER_BY' => $sort->get_order_by()); // Limit to certain types if requested if (isset($options['attention_type']) && $options['attention_type']) { $sql_ary['WHERE'][] = 'a.attention_type = ' . (int) $options['attention_type']; } // Limit to certain item if requested if (isset($options['attention_object_id'])) { $sql_ary['WHERE'][] = 'a.attention_object_id = ' . (int) $options['attention_object_id']; } // Do we want the closed ones? if (isset($options['only_closed']) && $options['only_closed']) { $sql_ary['WHERE'][] = 'a.attention_close_time <> 0'; } else { if (!isset($options['display_closed']) || $options['display_closed'] == false) { $sql_ary['WHERE'][] = 'a.attention_close_time = 0'; } } $sql_ary['WHERE'] = implode(' AND ', $sql_ary['WHERE']); // Main SQL Query $sql = phpbb::$db->sql_build_query('SELECT', $sql_ary); // Handle pagination if (!$sort->sql_count($sql_ary, 'a.attention_id')) { // No results...no need to query more... return; } $sort->build_pagination(titania_url::$current_page, titania_url::$params); // Get the data $result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start); $attention_ids = $user_ids = array(); while ($row = phpbb::$db->sql_fetchrow($result)) { $attention_ids[] = $row['attention_id']; $user_ids[] = $row['attention_poster_id']; $user_ids[] = $row['attention_requester']; $user_ids[] = $row['attention_close_user']; if ($row['attention_close_user']) { $user_ids[] = $row['attention_close_user']; } self::$attention_items[$row['attention_id']] = $row; } phpbb::$db->sql_freeresult($result); // Grab some users users_overlord::load_users($user_ids); // Output time $attention = new titania_attention(); foreach ($attention_ids as $attention_id) { $row = self::$attention_items[$attention_id]; $attention->__set_array($row); $output = array_merge($attention->assign_details(true), users_overlord::assign_details($row['attention_poster_id']), users_overlord::assign_details($row['attention_requester'], 'REPORTER_'), users_overlord::assign_details($row['attention_close_user'], 'CLOSER_')); // Do we have to? if ($row['attention_close_user']) { $output = array_merge($output, users_overlord::assign_details($row['attention_close_user'], 'CLOSE_')); } $template_block = isset($options['template_block']) ? $options['template_block'] : 'attention'; phpbb::$template->assign_block_vars($template_block, $output); } unset($attention); }
/** * Assign details for the source post. */ public function assign_source_object_details() { users_overlord::load_users(array($this->post->post_user_id, $this->post->post_edit_user, $this->post->post_delete_user)); users_overlord::assign_details($this->post->post_user_id, 'POSTER_', true); $this->load_contrib_object(); $action_param = array('hash' => generate_link_hash('attention_action')); phpbb::$template->assign_vars(array('OBJECT_TYPE' => $this->get_lang_string('object'), 'PARENT' => $this->contrib->contrib_name, 'U_PARENT' => $this->contrib->get_url(), 'POST_SUBJECT' => censor_text($this->post->post_subject), 'POST_DATE' => phpbb::$user->format_date($this->post->post_time), 'POST_TEXT' => $this->post->generate_text_for_display(), 'EDITED_MESSAGE' => $this->post->post_edited ? sprintf(phpbb::$user->lang['EDITED_MESSAGE'], users_overlord::get_user($this->post->post_edit_user, '_full'), phpbb::$user->format_date($this->post->post_edited)) : '', 'DELETED_MESSAGE' => $this->post->post_deleted != 0 ? sprintf(phpbb::$user->lang['DELETED_MESSAGE'], users_overlord::get_user($this->post->post_delete_user, '_full'), phpbb::$user->format_date($this->post->post_deleted), $this->post->get_url('undelete')) : '', 'POST_EDIT_REASON' => censor_text($this->post->post_edit_reason), 'U_APPROVE' => !$this->post->post_approved ? $this->get_report_url('approve', $action_param) : false, 'U_DISAPPROVE' => !$this->post->post_approved ? $this->get_report_url('disapprove', $action_param) : false, 'U_VIEW' => $this->post->get_url(), 'U_EDIT' => $this->post->get_url('edit'), 'SECTION_NAME' => '<a href="' . $this->post->get_url() . '">' . censor_text($this->post->post_subject) . '</a> - ' . phpbb::$user->lang['ATTENTION'], 'S_UNAPPROVED' => !$this->post->post_approved)); }
/** * Assign details for the source contribution. */ public function assign_source_object_details() { users_overlord::load_users(array($this->contrib->contrib_user_id)); users_overlord::assign_details($this->contrib->contrib_user_id, 'POSTER_', true); phpbb::$template->assign_vars(array('OBJECT_TYPE' => $this->get_lang_string('object'), 'POST_SUBJECT' => censor_text($this->contrib->contrib_name), 'POST_DATE' => phpbb::$user->format_date($this->contrib->contrib_last_update), 'POST_TEXT' => $this->contrib->generate_text_for_display(), 'U_VIEW' => $this->contrib->get_url(), 'U_EDIT' => $this->contrib->get_url('manage'), 'SECTION_NAME' => '<a href="' . $this->contrib->get_url() . '">' . censor_text($this->contrib->contrib_name) . '</a> - ' . phpbb::$user->lang['ATTENTION'])); }