/** * Assign document variables to template. * * @param array $documents Documents * @return null */ protected function assign_doc_vars($documents) { foreach ($documents as $document) { $this->template->assign_block_vars('searchresults', array('POST_AUTHOR_FULL' => $document['author'] ? \users_overlord::get_user($document['author'], '_full') : false, 'POST_DATE' => $document['date'] ? $this->user->format_date($document['date']) : false, 'POST_SUBJECT' => censor_text($document['title']), 'MESSAGE' => generate_text_for_display($document['text'], $document['text_uid'], $document['text_bitfield'], $document['text_options']), 'U_VIEW_POST' => $this->get_document_url($document['type'], $document['url']))); } }
/** * Get profile url * * @param string $page The page we are on (Ex: faq/support/details) * * @return string */ public function get_url($page = '') { if ($page) { return titania_url::build_url(users_overlord::get_user($this->user_id, '_unbuilt_titania_profile') . '/' . $page); } return users_overlord::get_user($this->user_id, '_titania_profile'); }
WHERE contrib_id = ' . titania::$contrib->contrib_id; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $contrib_categories[] = $row['category_id']; } phpbb::$db->sql_freeresult($result); $active_coauthors = $nonactive_coauthors = array(); foreach (titania::$contrib->coauthors as $row) { // User does not exist anymore... if (users_overlord::get_user($row['user_id'], 'user_id') != $row['user_id']) { continue; } if ($row['active']) { $active_coauthors[] = users_overlord::get_user($row['user_id'], 'username'); } else { $nonactive_coauthors[] = users_overlord::get_user($row['user_id'], 'username'); } } $active_coauthors = implode("\n", $active_coauthors); $nonactive_coauthors = implode("\n", $nonactive_coauthors); } } // Generate some stuff generate_category_select($contrib_categories); titania::$contrib->assign_details(); $message->display(); foreach ($status_list as $status => $row) { phpbb::$template->assign_block_vars('status_select', array('S_SELECTED' => $status == titania::$contrib->contrib_status ? true : false, 'VALUE' => $status, 'NAME' => phpbb::$user->lang[$row])); } phpbb::$template->assign_vars(array('S_POST_ACTION' => titania::$contrib->get_url('manage'), 'S_EDIT_SUBJECT' => titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate') ? true : false, 'S_DELETE_CONTRIBUTION' => phpbb::$auth->acl_get('u_titania_admin') ? true : false, 'S_IS_OWNER' => titania::$contrib->is_author ? true : false, 'S_IS_MODERATOR' => titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate') ? true : false, 'S_CAN_EDIT_STYLE_DEMO' => titania::$config->can_modify_style_demo_url || titania_types::$types[TITANIA_TYPE_STYLE]->acl_get('moderate') || titania::$contrib->contrib_type != TITANIA_TYPE_STYLE ? true : false, 'CONTRIB_PERMALINK' => $permalink, 'SCREENSHOT_UPLOADER' => $screenshot->parse_uploader('posting/attachments/simple.html'), 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : false, 'ACTIVE_COAUTHORS' => $active_coauthors, 'NONACTIVE_COAUTHORS' => $nonactive_coauthors, 'S_TRANSLATION_TYPE_ID' => defined('TITANIA_TYPE_TRANSLATION') ? TITANIA_TYPE_TRANSLATION : 0)); titania::page_header(titania::$contrib->contrib_name . ' - ' . phpbb::$user->lang['MANAGE_CONTRIBUTION']);
/** * Get coauthor usernames. * * @return array */ protected function get_coauthor_usernames() { $coauthors = array('active' => array(), 'nonactive' => array()); foreach ($this->contrib->coauthors as $data) { $user = \users_overlord::get_user($data['user_id']); // Make sure user still exists. if ($user['user_id'] == $data['user_id']) { $status = $data['active'] ? 'active' : 'nonactive'; $coauthors[$status][] = $user['username']; } } return $coauthors; }
/** * Rebuild (or create) the first post in the queue topic */ public function update_first_queue_post($post_subject = false) { $this->user->add_lang_ext('phpbb/titania', 'manage'); if (!$this->queue_topic_id) { $sql = 'SELECT contrib_type FROM ' . TITANIA_CONTRIBS_TABLE . ' WHERE contrib_id = ' . $this->contrib_id; phpbb::$db->sql_query($sql); $contrib_type = phpbb::$db->sql_fetchfield('contrib_type'); phpbb::$db->sql_freeresult(); // Create the topic $post = new titania_post(TITANIA_QUEUE); $post->post_access = access::TEAM_LEVEL; $post->topic->parent_id = $this->queue_id; $post->topic->topic_category = $contrib_type; $post->topic->topic_url = serialize(array('id' => $this->queue_id)); } else { // Load the first post $topic = new titania_topic(); $topic->topic_id = $this->queue_topic_id; $topic->load(); $post = new titania_post($topic->topic_type, $topic, $topic->topic_first_post_id); $post->load(); } if ($post_subject) { $post->post_subject = $post_subject; } $post->post_user_id = $this->submitter_user_id; $post->post_time = $this->queue_submit_time; $revision = $this->get_revision(); // Reset the post text $post->post_text = ''; // Queue Discussion Link $queue_topic = $this->get_queue_discussion_topic(); $post->post_text .= '[url=' . $queue_topic->get_url() . ']' . phpbb::$user->lang['QUEUE_DISCUSSION_TOPIC'] . "[/url]\n\n"; if ($revision->revision_status == TITANIA_REVISION_ON_HOLD) { $post->post_text .= '<strong>' . phpbb::$user->lang['REVISION_FOR_NEXT_PHPBB'] . "</strong>\n\n"; } // Put text saying whether repacking is allowed or not $post->post_text .= phpbb::$user->lang[$this->queue_allow_repack ? 'QUEUE_REPACK_ALLOWED' : 'QUEUE_REPACK_NOT_ALLOWED'] . "\n\n"; // Add the queue notes if ($this->queue_notes) { $queue_notes = $this->queue_notes; message::decode($queue_notes, $this->queue_notes_uid); $post->post_text .= '[quote="' . users_overlord::get_user($this->submitter_user_id, 'username', true) . '"]' . $queue_notes . "[/quote]\n"; } // Add the MPV results if ($this->mpv_results) { $mpv_results = $this->mpv_results; message::decode($mpv_results, $this->mpv_results_uid); $post->post_text .= '[quote="' . phpbb::$user->lang['VALIDATION_PV'] . '"]' . $mpv_results . "[/quote]\n"; } // Add the Automod results if ($this->automod_results) { $post->post_text .= '[quote="' . phpbb::$user->lang['VALIDATION_AUTOMOD'] . '"]' . $this->automod_results . "[/quote]\n"; } // Prevent errors from different configurations phpbb::$config['min_post_chars'] = 1; phpbb::$config['max_post_chars'] = 0; // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $post, $this); // Store the post $post->generate_text_for_storage(true, true, true); $post->submit(); $this->queue_topic_id = $post->topic_id; }
/** * Get quote for a post. * * @param int $post_id * @return string */ protected function get_quote($post_id) { $text = ''; $quote = $this->load_post($post_id); $quoted_post_is_accessible = $this->access->get_level() <= min($quote->post_access, $quote->topic->topic_access); $can_quote_post = $this->auth->acl_get('u_titania_mod_post_mod') || $quote->post_approved && (!$quote->post_deleted || $quote->post_deleted == $this->user->data['user_id']); // Permission check if ($quoted_post_is_accessible && $can_quote_post) { $for_edit = $quote->generate_text_for_edit(); $quote_username = \users_overlord::get_user($quote->post_user_id, '_username', true); $text = '[quote="' . $quote_username . '"]' . $for_edit['text'] . '[/quote]'; } return $text; }
/** * 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)); }
/** * Reply to an existing topic * * @param mixed $topic_id */ public function reply($topic_id, $quote_post_id = false) { if (!phpbb::$auth->acl_get('u_titania_post')) { titania::needs_auth(); } // Load the stuff we need $topic = $this->load_topic($topic_id); $post_object = new titania_post($topic->topic_type, $topic); // Check permissions if (!$post_object->acl_get('reply')) { titania::needs_auth(); } // Quoting? if ($quote_post_id !== false && $post_object->post_text == '') { $quote = $this->load_post($quote_post_id); // Permission check if (titania::$access_level <= min($quote->post_access, $quote->topic->topic_access) && (phpbb::$auth->acl_get('u_titania_mod_post_mod') || $quote->post_approved && (!$quote->post_deleted || $quote->post_deleted == phpbb::$user->data['user_id']))) { $for_edit = $quote->generate_text_for_edit(); $post_object->post_text = '[quote="' . users_overlord::get_user($quote->post_user_id, '_username', true) . '"]' . $for_edit['text'] . '[/quote]'; } } // Load the message object $message_object = new titania_message($post_object); $message_object->set_auth(array('bbcode' => phpbb::$auth->acl_get('u_titania_bbcode'), 'smilies' => phpbb::$auth->acl_get('u_titania_smilies'), 'lock_topic' => phpbb::$auth->acl_get('u_titania_mod_post_mod') || (phpbb::$auth->acl_get('u_titania_post_mod_own') && is_object(titania::$contrib) && titania::$contrib->contrib_id == $post_object->topic->parent_id && titania::$contrib->is_author || titania::$contrib->is_active_coauthor) ? true : false, 'attachments' => phpbb::$auth->acl_get('u_titania_post_attach'))); $message_object->set_settings(array('display_captcha' => !phpbb::$user->data['is_registered'] ? true : false, 'subject_default_override' => 'Re: ' . $post_object->topic->topic_subject)); // Call our common posting handler $this->common_post('reply', $post_object, $message_object); // Setup the sort tool $topic_sort = posts_overlord::build_sort(); $topic_sort->set_defaults(false, false, 'd'); // Display the posts for review posts_overlord::display_topic($post_object->topic, $topic_sort); // Common stuff phpbb::$template->assign_vars(array('S_POST_ACTION' => $post_object->topic->get_url('reply', titania_url::$current_page_url), 'L_POST_A' => phpbb::$user->lang['POST_REPLY'], 'S_DISPLAY_REVIEW' => true)); titania::page_header('POST_REPLY'); }
$lang_path = phpbb::$user->lang_path; phpbb::$user->set_custom_lang_path(titania::$config->language_path); $messenger = new messenger(false); users_overlord::load_users(array($post->post_user_id)); $email_template = $post->post_id == $post->topic->topic_first_post_id && $post->post_id == $post->topic->topic_last_post_id ? 'topic_approved' : 'post_approved'; $messenger->template($email_template, users_overlord::get_user($post->post_user_id, 'user_lang')); $messenger->to(users_overlord::get_user($post->post_user_id, 'user_email'), users_overlord::get_user($post->post_user_id, '_username')); $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode(users_overlord::get_user($post->post_user_id, '_username')), 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post->post_subject)), 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post->topic->topic_subject)), 'U_VIEW_TOPIC' => titania_url::append_url($post->topic->get_url()), 'U_VIEW_POST' => titania_url::append_url($post->get_url()))); $messenger->send(); phpbb::$user->set_custom_lang_path($lang_path); } redirect(titania_url::build_url(titania_url::$current_page)); } users_overlord::load_users(array($post->post_user_id, $post->post_edit_user, $post->post_delete_user)); 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']));
/** * 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); }
/** * Get contrib support area template row. * * @param array $row * @return array */ protected function get_support_tpl_row($row) { $contrib = $this->get_contrib($row); return array('SUBSCRIPTION_AUTHOR_FULL' => \users_overlord::get_user($row['contrib_user_id'], '_full'), 'SUBSCRIPTION_ID' => $row['watch_object_id'], 'SUBSCRIPTION_TARGET' => $this->user->lang['SUBSCRIPTION_SUPPORT'], 'SUBSCRIPTION_TIME' => $this->user->format_date($row['contrib_last_update']), 'SUBSCRIPTION_TITLE' => $row['contrib_name'], 'SUBSCRIPTION_TYPE' => $row['watch_object_type'], 'U_VIEW_SUBSCRIPTION' => $this->get_real_url($contrib->get_url('support'))); }
/** * Update the release topic for this contribution */ public function update_release_topic() { if ($this->type->forum_robot && $this->type->forum_database && $this->type->create_public) { titania::_include('functions_posting', 'phpbb_posting'); // Get the latest download $this->get_download(); // If there is not a download do not update. if (!$this->download) { return; } // Get the latest revision $this->get_revisions(); // If there is not a revision do not update. if (!$this->revisions) { return; } $contrib_description = $this->contrib_desc; message::decode($contrib_description, $this->contrib_desc_uid); foreach ($this->download as $download) { $phpbb_version = $this->revisions[$download['revision_id']]['phpbb_versions'][0]; $branch = (int) $phpbb_version['phpbb_version_branch']; if (empty($this->type->forum_database[$branch])) { continue; } $u_download = $this->controller_helper->route('phpbb.titania.download', array('id' => $download['attachment_id'])); // Global body and options $body = phpbb::$user->lang($this->type->create_public, $this->contrib_name, $this->path_helper->strip_url_params($this->author->get_url(), 'sid'), users_overlord::get_user($this->author->user_id, '_username'), $contrib_description, $download['revision_version'], $this->path_helper->strip_url_params($u_download, 'sid'), $download['real_filename'], get_formatted_filesize($download['filesize']), $this->path_helper->strip_url_params($this->get_url(), 'sid'), $this->path_helper->strip_url_params($this->get_url('support'), 'sid'), $phpbb_version['phpbb_version_branch'][0] . '.' . $phpbb_version['phpbb_version_branch'][1] . '.' . $phpbb_version['phpbb_version_revision']); $options = array('poster_id' => $this->type->forum_robot, 'forum_id' => $this->type->forum_database[$branch]); $release_topic_id = (int) $this->get_release_topic_id($branch); if ($release_topic_id) { // We edit the first post of contrib release topic $options_edit = array('topic_id' => $release_topic_id, 'topic_title' => $this->contrib_name, 'post_text' => $body); $options_edit = array_merge($options_edit, $options); phpbb_posting('edit_first_post', $options_edit); } else { // We create a new topic in database $options_post = array('topic_title' => $this->contrib_name, 'post_text' => $body); $options_post = array_merge($options_post, $options); $release_topic_id = phpbb_posting('post', $options_post); $this->set_release_topic_id($branch, $release_topic_id); } } } }
/** * Update the release topic for this contribution */ public function update_release_topic() { if (titania_types::$types[$this->contrib_type]->forum_robot && titania_types::$types[$this->contrib_type]->forum_database && titania_types::$types[$this->contrib_type]->create_public) { titania::_include('functions_posting', 'phpbb_posting'); // Get the latest download $this->get_download(); // If there is not a download do not update. if (!$this->download) { return; } // Get the latest revision $this->get_revisions(); // If there is not a revision do not update. if (!$this->revisions) { return; } $phpbb_version = $this->revisions[$this->download['revision_id']]['phpbb_versions'][0]; $contrib_description = $this->contrib_desc; titania_decode_message($contrib_description, $this->contrib_desc_uid); // Global body and options $body = sprintf(phpbb::$user->lang[titania_types::$types[$this->contrib_type]->create_public], $this->contrib_name, titania_url::remove_sid($this->author->get_url()), users_overlord::get_user($this->author->user_id, '_username'), $contrib_description, $this->download['revision_version'], titania_url::build_clean_url('download', array('id' => $this->download['attachment_id'])), $this->download['real_filename'], $this->download['filesize'], titania_url::remove_sid($this->get_url()), titania_url::remove_sid($this->get_url('support')), $phpbb_version['phpbb_version_branch'][0] . '.' . $phpbb_version['phpbb_version_branch'][1] . '.' . $phpbb_version['phpbb_version_revision']); $options = array('poster_id' => titania_types::$types[$this->contrib_type]->forum_robot, 'forum_id' => titania_types::$types[$this->contrib_type]->forum_database); if ($this->contrib_release_topic_id) { // We edit the first post of contrib release topic $options_edit = array('topic_id' => $this->contrib_release_topic_id, 'topic_title' => $this->contrib_name, 'post_text' => $body); $options_edit = array_merge($options_edit, $options); phpbb_posting('edit_first_post', $options_edit); } else { // We create a new topic in database $options_post = array('topic_title' => $this->contrib_name, 'post_text' => $body); $options_post = array_merge($options_post, $options); $this->contrib_release_topic_id = phpbb_posting('post', $options_post); $sql = 'UPDATE ' . $this->sql_table . ' SET contrib_release_topic_id = ' . $this->contrib_release_topic_id . ' WHERE contrib_id = ' . $this->contrib_id; phpbb::$db->sql_query($sql); } } }
/** * Get author profile * * @param array $data Data to generate username_string - user_id, username, username_clean, user_colour * @return array */ protected function get_author_profile($data) { \users_overlord::$users[$data['user_id']] = $data; return \users_overlord::get_user($data['user_id'], '_titania', false); }
/** * Copy new posts for queue discussion, queue to the forum */ function phpbb_com_titania_queue_update_first_queue_post($hook, &$post_object, $queue_object) { if ($queue_object->queue_status == TITANIA_QUEUE_HIDE || !$queue_object->queue_topic_id) { return; } // First we copy over the queue discussion topic if required $sql = 'SELECT topic_id, phpbb_topic_id, topic_category FROM ' . TITANIA_TOPICS_TABLE . ' WHERE parent_id = ' . $queue_object->contrib_id . ' AND topic_type = ' . TITANIA_QUEUE_DISCUSSION; $result = phpbb::$db->sql_query($sql); $topic_row = phpbb::$db->sql_fetchrow($result); phpbb::$db->sql_freeresult($result); // Do we need to create the queue discussion topic or not? if ($topic_row['topic_id'] && !$topic_row['phpbb_topic_id']) { $forum_id = phpbb_com_forum_id($post_object->topic->topic_category, TITANIA_QUEUE_DISCUSSION); $temp_post = new titania_post(); // Go through any posts in the queue discussion topic and copy them $topic_id = false; $sql = 'SELECT * FROM ' . TITANIA_POSTS_TABLE . ' WHERE topic_id = ' . $topic_row['topic_id']; $result = phpbb::$db->sql_query($sql); while ($row = phpbb::$db->sql_fetchrow($result)) { $temp_post->__set_array($row); $post_text = $row['post_text']; titania_decode_message($post_text, $row['post_text_uid']); $post_text .= "\n\n" . titania_url::remove_sid($temp_post->get_url()); $options = array('poster_id' => $row['post_user_id'], 'forum_id' => $forum_id, 'topic_title' => $row['post_subject'], 'post_text' => $post_text); titania::_include('functions_posting', 'phpbb_posting'); if ($topic_id) { $options = array_merge($options, array('topic_id' => $topic_id)); phpbb_posting('reply', $options); } else { switch ($topic_row['topic_category']) { case TITANIA_TYPE_MOD: $options['poster_id'] = titania::$config->forum_mod_robot; break; case TITANIA_TYPE_STYLE: $options['poster_id'] = titania::$config->forum_style_robot; break; } $topic_id = phpbb_posting('post', $options); } } phpbb::$db->sql_freeresult($result); if ($topic_id) { $sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . ' SET phpbb_topic_id = ' . $topic_id . ' WHERE topic_id = ' . $topic_row['topic_id']; phpbb::$db->sql_query($sql); } unset($temp_post); } // Does a queue topic already exist? If so, don't repost. $sql = 'SELECT phpbb_topic_id FROM ' . TITANIA_TOPICS_TABLE . ' WHERE topic_id = ' . $queue_object->queue_topic_id; phpbb::$db->sql_query($sql); $phpbb_topic_id = phpbb::$db->sql_fetchfield('phpbb_topic_id'); phpbb::$db->sql_freeresult(); if ($phpbb_topic_id) { return; } $forum_id = phpbb_com_forum_id($post_object->topic->topic_category, $post_object->topic->topic_type); if (!$forum_id) { return; } $post_object->submit(); titania::_include('functions_posting', 'phpbb_posting'); // Need some stuff titania::add_lang('contributions'); $contrib = new titania_contribution(); $contrib->load((int) $queue_object->contrib_id); $revision = $queue_object->get_revision(); $contrib->get_download($revision->revision_id); switch ($post_object->topic->topic_category) { case TITANIA_TYPE_MOD: $post_object->topic->topic_first_post_user_id = titania::$config->forum_mod_robot; $lang_var = 'MOD_QUEUE_TOPIC'; break; case TITANIA_TYPE_STYLE: $post_object->topic->topic_first_post_user_id = titania::$config->forum_style_robot; $lang_var = 'STYLE_QUEUE_TOPIC'; break; default: return; break; } $description = $contrib->contrib_desc; titania_decode_message($description, $contrib->contrib_desc_uid); $post_text = sprintf(phpbb::$user->lang[$lang_var], $contrib->contrib_name, $contrib->author->get_url(), users_overlord::get_user($contrib->author->user_id, '_username'), $description, $revision->revision_version, titania_url::build_url('download', array('id' => $revision->attachment_id)), $contrib->download['real_filename'], $contrib->download['filesize']); $post_text .= "\n\n" . $post_object->post_text; titania_decode_message($post_text, $post_object->post_text_uid); $post_text .= "\n\n" . titania_url::remove_sid($post_object->get_url()); $options = array('poster_id' => $post_object->topic->topic_first_post_user_id, 'forum_id' => $forum_id, 'topic_title' => $post_object->topic->topic_subject, 'post_text' => $post_text); $topic_id = phpbb_posting('post', $options); $post_object->topic->phpbb_topic_id = $topic_id; $sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . ' SET phpbb_topic_id = ' . (int) $topic_id . ' WHERE topic_id = ' . $post_object->topic->topic_id; phpbb::$db->sql_query($sql); }
/** * Get profile url * * @param string $page The page we are on (Ex: faq/support/details) * @param array $parameters Extra parameters. * * @return string */ public function get_url($page = '', $parameters = array()) { $parameters += array('author' => users_overlord::get_user($this->user_id, '_unbuilt_titania_profile'), 'page' => $page); return $this->controller_helper->route('phpbb.titania.author', $parameters); }
/** * Assign details * * A little different from those in other classes, this one only returns the info ready for output */ public function assign_details($output_text = true) { $details = array('POST_ID' => $this->post_id, 'TOPIC_ID' => $this->topic_id, 'POST_TYPE' => $this->post_type, 'POST_ACCESS' => $this->post_access, 'POST_LOCKED' => $this->post_locked, 'POST_ATTACHMENT' => $this->post_attachment, 'POST_USER_ID' => $this->post_user_id, 'POST_IP' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->post_ip : false, 'POST_TIME' => phpbb::$user->format_date($this->post_time), 'POST_EDIT_REASON' => censor_text($this->post_edit_reason), 'POST_SUBJECT' => censor_text($this->post_subject), 'POST_TEXT' => $output_text ? $this->generate_text_for_display() : '', 'EDITED_MESSAGE' => $this->post_edited ? sprintf(phpbb::$user->lang['EDITED_MESSAGE'], users_overlord::get_user($this->post_edit_user, '_full'), phpbb::$user->format_date($this->post_edited)) : '', 'DELETED_MESSAGE' => $this->post_deleted != 0 ? sprintf(phpbb::$user->lang['DELETED_MESSAGE'], users_overlord::get_user($this->post_delete_user, '_full'), phpbb::$user->format_date($this->post_deleted), $this->get_url('undelete')) : '', 'U_VIEW' => $this->get_url(), 'U_EDIT' => $this->acl_get('edit') ? $this->get_url('edit') : '', 'U_QUICKEDIT' => $this->acl_get('edit') ? $this->get_url('quick_edit') : '', 'U_DELETE' => $this->acl_get('delete') && (!$this->post_deleted || phpbb::$auth->acl_get('u_titania_post_hard_delete')) ? $this->get_url('delete') : '', 'U_REPORT' => phpbb::$user->data['is_registered'] ? $this->get_url('report') : '', 'U_WARN' => false, 'U_INFO' => phpbb::$auth->acl_gets('u_titania_mod_author_mod', 'u_titania_mod_contrib_mod', 'u_titania_mod_faq_mod', 'u_titania_mod_post_mod') || sizeof(titania_types::find_authed('moderate')) ? titania_url::build_url('manage/attention', array('type' => TITANIA_POST, 'id' => $this->post_id)) : '', 'U_QUOTE' => $this->acl_get('post') ? $this->get_url('quote') : '', 'S_UNREAD_POST' => $this->unread ? true : false, 'S_POST_APPROVED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->post_approved : true, 'S_POST_REPORTED' => phpbb::$auth->acl_get('u_titania_mod_post_mod') ? $this->post_reported : false, 'S_POST_DELETED' => $this->post_deleted != 0 ? true : false, 'S_ACCESS_TEAMS' => $this->post_access == TITANIA_ACCESS_TEAMS ? true : false, 'S_ACCESS_AUTHORS' => $this->post_access == TITANIA_ACCESS_AUTHORS ? true : false); // Hooks titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $details, $this); return $details; }
{ $url_params = substr($url_base, (strrpos($url_base, '/') + 1)); $url_base = substr($url_base, 0, (strrpos($url_base, '/') + 1)); } phpbb::$template->assign_block_vars('searchresults', array( 'TOPIC_TITLE' => censor_text($document->title), 'TOPIC_AUTHOR_FULL' => users_overlord::get_user($document->author, '_full'), 'FIRST_POST_TIME' => phpbb::$user->format_date($document->date), 'U_VIEW_TOPIC' => titania_url::build_url($url_base, $url_params), 'S_TOPIC_REPORTED' => ($document->reported) ? true : false, //'S_TOPIC_UNAPPROVED' => (!$document->approved) ? true : false, )); } break; default : */ foreach ($results['documents'] as $document) { $url_base = $url_params = ''; titania_url::split_base_params($url_base, $url_params, $document->url); phpbb::$template->assign_block_vars('searchresults', array('POST_SUBJECT' => censor_text($document->title), 'MESSAGE' => titania_generate_text_for_display($document->text, $document->text_uid, $document->text_bitfield, $document->text_options), 'POST_AUTHOR_FULL' => $document->author ? users_overlord::get_user($document->author, '_full') : false, 'POST_DATE' => $document->date ? phpbb::$user->format_date($document->date) : false, 'U_VIEW_POST' => titania_url::build_url($url_base, $url_params), 'S_POST_REPORTED' => $document->reported ? true : false)); } /* break; }*/ $sort->build_pagination(titania_url::$current_page, titania_url::$params); titania::page_header('SEARCH'); phpbb::$template->assign_vars(array('SEARCH_WORDS' => $keywords, 'SEARCH_MATCHES' => $sort->total == 1 ? sprintf(phpbb::$user->lang['FOUND_SEARCH_MATCH'], $sort->total) : sprintf(phpbb::$user->lang['FOUND_SEARCH_MATCHES'], $sort->total), 'U_SEARCH_WORDS' => titania_url::build_url(titania_url::$current_page, titania_url::$params), 'U_SEARCH' => titania_url::build_url($mode == 'find-contribution' ? 'find-contribution' : 'search'), 'S_IN_SEARCH' => true, 'S_SEARCH_ACTION' => titania_url::$current_page_url)); titania::page_footer(true, 'search_results.html');
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'); }
/** * Send an individual a notification. * @todo This should probably be moved somewhere else so it can be reused. * * @param int $user_id * @param string $email_template * @param array $message_vars Additional variables for email message. */ public function notify_user($user_id, $email_template, $message_vars) { if ($user_id == ANONYMOUS) { return; } phpbb::_include('functions_messenger', false, 'messenger'); $lang_path = phpbb::$user->lang_path; phpbb::$user->set_custom_lang_path(titania::$config->language_path); $messenger = new messenger(false); users_overlord::load_users(array($user_id)); $messenger->template($email_template, users_overlord::get_user($user_id, 'user_lang')); $messenger->to(users_overlord::get_user($user_id, 'user_email'), users_overlord::get_user($user_id, '_username')); $messenger->assign_vars(array_merge($message_vars, array('USERNAME' => htmlspecialchars_decode(users_overlord::get_user($user_id, '_username'))))); $messenger->send(); phpbb::$user->set_custom_lang_path($lang_path); // This gets reset when $template->_tpl_load() gets called phpbb::$user->theme['template_inherits_id'] = 1; }