本文整理汇总了PHP中phpbb\event\dispatcher_interface::trigger_event方法的典型用法代码示例。如果您正苦于以下问题:PHP dispatcher_interface::trigger_event方法的具体用法?PHP dispatcher_interface::trigger_event怎么用?PHP dispatcher_interface::trigger_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\event\dispatcher_interface
的用法示例。
在下文中一共展示了dispatcher_interface::trigger_event方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Controller for /help/{mode} routes
*
* @param string $mode
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
* @throws http_exception when the $mode is not known by any extension
*/
public function handle($mode)
{
switch ($mode) {
case 'faq':
case 'bbcode':
$page_title = $mode === 'faq' ? $this->user->lang['FAQ_EXPLAIN'] : $this->user->lang['BBCODE_GUIDE'];
$this->user->add_lang($mode, false, true);
break;
default:
$page_title = $this->user->lang['FAQ_EXPLAIN'];
$ext_name = $lang_file = '';
/**
* You can use this event display a custom help page
*
* @event core.faq_mode_validation
* @var string page_title Title of the page
* @var string mode FAQ that is going to be displayed
* @var string lang_file Language file containing the help data
* @var string ext_name Vendor and extension name where the help
* language file can be loaded from
* @since 3.1.4-RC1
*/
$vars = array('page_title', 'mode', 'lang_file', 'ext_name');
extract($this->dispatcher->trigger_event('core.faq_mode_validation', compact($vars)));
if ($ext_name === '' || $lang_file === '') {
throw new http_exception(404, 'Not Found');
}
$this->user->add_lang($lang_file, false, true, $ext_name);
break;
}
$this->template->assign_vars(array('L_FAQ_TITLE' => $page_title, 'S_IN_FAQ' => true));
$this->assign_to_template($this->user->help);
make_jumpbox(append_sid("{$this->root_path}viewforum.{$this->php_ext}"));
return $this->helper->render('faq_body.html', $page_title);
}
示例2: parse
/**
* {@inheritdoc}
*/
public function parse($text)
{
$parser = $this;
/**
* Modify a text before it is parsed
*
* @event core.text_formatter_s9e_parse_before
* @var \phpbb\textformatter\s9e\parser parser This parser service
* @var string text The original text
* @since 3.2.0-a1
*/
$vars = array('parser', 'text');
extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_before', compact($vars)));
$xml = $this->parser->parse($text);
/**
* Modify a parsed text in its XML form
*
* @event core.text_formatter_s9e_parse_after
* @var \phpbb\textformatter\s9e\parser parser This parser service
* @var string xml The parsed text, in XML
* @since 3.2.0-a1
*/
$vars = array('parser', 'xml');
extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_after', compact($vars)));
return $xml;
}
示例3: render
/**
* {@inheritdoc}
*/
public function render($xml)
{
if (isset($this->quote_helper)) {
$xml = $this->quote_helper->inject_metadata($xml);
}
$renderer = $this;
/**
* Modify a parsed text before it is rendered
*
* @event core.text_formatter_s9e_render_before
* @var \phpbb\textformatter\s9e\renderer renderer This renderer service
* @var string xml The parsed text, in its XML form
* @since 3.2.0-a1
*/
$vars = array('renderer', 'xml');
extract($this->dispatcher->trigger_event('core.text_formatter_s9e_render_before', compact($vars)));
if (isset($this->censor) && $this->viewcensors) {
// NOTE: censorHtml() is XML-safe
$xml = $this->censor->censorHtml($xml, true);
}
$html = $this->renderer->render($xml);
/**
* Modify a rendered text
*
* @event core.text_formatter_s9e_render_after
* @var string html The rendered text's HTML
* @var \phpbb\textformatter\s9e\renderer renderer This renderer service
* @since 3.2.0-a1
*/
$vars = array('html', 'renderer');
extract($this->dispatcher->trigger_event('core.text_formatter_s9e_render_after', compact($vars)));
return $html;
}
示例4: get_item
/**
* {@inheritdoc}
*/
public function get_item()
{
if (!isset($this->result)) {
if (!$this->get_sql()) {
return false;
}
$sql_ary = $this->sql;
/**
* Event to modify the feed item sql
*
* @event core.feed_base_modify_item_sql
* @var array sql_ary The SQL array to get the feed item data
*
* @since 3.1.10-RC1
*/
$vars = array('sql_ary');
extract($this->phpbb_dispatcher->trigger_event('core.feed_base_modify_item_sql', compact($vars)));
$this->sql = $sql_ary;
unset($sql_ary);
// Query database
$sql = $this->db->sql_build_query('SELECT', $this->sql);
$this->result = $this->db->sql_query_limit($sql, $this->num_items);
}
return $this->db->sql_fetchrow($this->result);
}
示例5: add_notifications
/**
* Add a notification
*
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $data is identical for the specified types)
* Note: If you send an array of types, any user who could receive multiple notifications from this single item will only receive
* a single notification. If they MUST receive multiple notifications, call this function multiple times instead of sending an array
* @param array $data Data specific for this type that will be inserted
* @param array $options Optional options to control what notifications are loaded
* ignore_users array of data to specify which users should not receive certain types of notifications
* @return array Information about what users were notified and how they were notified
*/
public function add_notifications($notification_type_name, $data, array $options = array())
{
$options = array_merge(array('ignore_users' => array()), $options);
if (is_array($notification_type_name)) {
$notified_users = array();
$temp_options = $options;
foreach ($notification_type_name as $type) {
$temp_options['ignore_users'] = $options['ignore_users'] + $notified_users;
$notified_users += $this->add_notifications($type, $data, $temp_options);
}
return $notified_users;
}
// find out which users want to receive this type of notification
$notify_users = $this->get_item_type_class($notification_type_name)->find_users_for_notification($data, $options);
/**
* Allow filtering the notify_users array for a notification that is about to be sent.
* Here, $notify_users is already filtered by f_read and the ignored list included in the options variable
*
* @event core.notification_manager_add_notifications
* @var string notification_type_name The forum id from where the topic belongs
* @var array data Data specific for the notification_type_name used will be inserted
* @var array notify_users The array of userid that are going to be notified for this notification. Set to array() to cancel.
* @var array options The options that were used when this method was called (read only)
*
* @since 3.1.3-RC1
*/
$vars = array('notification_type_name', 'data', 'notify_users', 'options');
extract($this->phpbb_dispatcher->trigger_event('core.notification_manager_add_notifications', compact($vars)));
$this->add_notifications_for_users($notification_type_name, $data, $notify_users);
return $notify_users;
}
示例6: get_global_visibility_sql
/**
* Create topic/post visibility SQL for all forums on the board
*
* Note: Read permissions are not checked. Forums without read permissions
* should be in $exclude_forum_ids
*
* @param $mode string Either "topic" or "post"
* @param $exclude_forum_ids array Array of forum ids which are excluded
* @param $table_alias string Table alias to prefix in SQL queries
* @return string The appropriate combination SQL logic for topic/post_visibility
*/
public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '')
{
$where_sqls = array();
$approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids);
$visibility_sql_overwrite = null;
/**
* Allow changing the result of calling get_global_visibility_sql
*
* @event core.phpbb_content_visibility_get_global_visibility_before
* @var array where_sqls The action the user tried to execute
* @var string mode Either "topic" or "post" depending on the query this is being used in
* @var array exclude_forum_ids Array of forum ids the current user doesn't have access to
* @var string table_alias Table alias to prefix in SQL queries
* @var array approve_forums Array of forums where the user has m_approve permissions
* @var string visibility_sql_overwrite Forces the function to return an implosion of where_sqls (joined by "OR")
* @since 3.1.3-RC1
*/
$vars = array('where_sqls', 'mode', 'exclude_forum_ids', 'table_alias', 'approve_forums', 'visibility_sql_overwrite');
extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_global_visibility_before', compact($vars)));
if ($visibility_sql_overwrite) {
return $visibility_sql_overwrite;
}
if (sizeof($exclude_forum_ids)) {
$where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true) . '
AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')';
} else {
$where_sqls[] = $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
}
if (sizeof($approve_forums)) {
$where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums);
return '(' . implode(' OR ', $where_sqls) . ')';
}
// There is only one element, so we just return that one
return $where_sqls[0];
}
示例7: __construct
/**
* Constructor
*
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher
* @param \phpbb\user $user User Object
*/
public function __construct(\phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\user $user)
{
$this->dispatcher = $phpbb_dispatcher;
$this->user = $user;
$categories = $this->categories;
$types = $this->types;
$permissions = $this->permissions;
/**
* Allows to specify additional permission categories, types and permissions
*
* @event core.permissions
* @var array types Array with permission types (a_, u_, m_, etc.)
* @var array categories Array with permission categories (pm, post, settings, misc, etc.)
* @var array permissions Array with permissions. Each Permission has the following layout:
* '<type><permission>' => array(
* 'lang' => 'Language Key with a Short description', // Optional, if not set,
* // the permissions identifier '<type><permission>' is used with
* // all uppercase.
* 'cat' => 'Identifier of the category, the permission should be displayed in',
* ),
* Example:
* 'u_viewprofile' => array(
* 'lang' => 'ACL_U_VIEWPROFILE',
* 'cat' => 'profile',
* ),
* @since 3.1.0-a1
*/
$vars = array('types', 'categories', 'permissions');
extract($phpbb_dispatcher->trigger_event('core.permissions', compact($vars)));
$this->categories = $categories;
$this->types = $types;
$this->permissions = $permissions;
}
示例8: generate_page_link
/**
* Generate a pagination link based on the url and the page information
*
* @param string $base_url is url prepended to all links generated within the function
* If you use page numbers inside your controller route, base_url should contains a placeholder (%d)
* for the page. Also be sure to specify the pagination path information into the start_name argument
* @param string $on_page is the page for which we want to generate the link
* @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20)
* If you use page numbers inside your controller route, start name should be the string
* that should be removed for the first page (example: /page/%d)
* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
* @return string URL for the requested page
*/
protected function generate_page_link($base_url, $on_page, $start_name, $per_page)
{
// A listener can set this variable to the new pagination URL
// to override the generate_page_link() function generated value
$generate_page_link_override = false;
/**
* Execute code and/or override generate_page_link()
*
* To override the generate_page_link() function generated value
* set $generate_page_link_override to the new URL value
*
* @event core.pagination_generate_page_link
* @var string base_url is url prepended to all links generated within the function
* If you use page numbers inside your controller route, base_url should contains a placeholder (%d)
* for the page. Also be sure to specify the pagination path information into the start_name argument
* @var string on_page is the page for which we want to generate the link
* @var string start_name is the name of the parameter containing the first item of the given page (example: start=20)
* If you use page numbers inside your controller route, start name should be the string
* that should be removed for the first page (example: /page/%d)
* @var int per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
* @var bool|string generate_page_link_override Shall we return custom pagination link (string URL) or not (false)
* @since 3.1.0-RC5
*/
$vars = array('base_url', 'on_page', 'start_name', 'per_page', 'generate_page_link_override');
extract($this->phpbb_dispatcher->trigger_event('core.pagination_generate_page_link', compact($vars)));
if ($generate_page_link_override) {
return $generate_page_link_override;
}
if (!is_string($base_url)) {
if (is_array($base_url['routes'])) {
$route = $on_page > 1 ? $base_url['routes'][1] : $base_url['routes'][0];
} else {
$route = $base_url['routes'];
}
$params = isset($base_url['params']) ? $base_url['params'] : array();
$is_amp = isset($base_url['is_amp']) ? $base_url['is_amp'] : true;
$session_id = isset($base_url['session_id']) ? $base_url['session_id'] : false;
if ($on_page > 1 || !is_array($base_url['routes'])) {
$params[$start_name] = (int) $on_page;
}
return $this->helper->route($route, $params, $is_amp, $session_id);
} else {
$url_delim = strpos($base_url, '?') === false ? '?' : (strpos($base_url, '?') === strlen($base_url) - 1 ? '' : '&');
return $on_page > 1 ? $base_url . $url_delim . $start_name . '=' . ($on_page - 1) * $per_page : $base_url;
}
}
示例9: send_feed_do
/**
* Really send the feed
*
* @param feed_interface $feed
*
* @return Response
*
* @throw exception\feed_exception
*/
protected function send_feed_do(feed_interface $feed)
{
$feed_updated_time = 0;
$item_vars = array();
$board_url = $this->feed_helper->get_board_url();
// Open Feed
$feed->open();
// Iterate through items
while ($row = $feed->get_item()) {
/**
* Event to modify the feed row
*
* @event core.feed_modify_feed_row
* @var int forum_id Forum ID
* @var string mode Feeds mode (forums|topics|topics_new|topics_active|news)
* @var array row Array with feed data
* @var int topic_id Topic ID
*
* @since 3.1.10-RC1
*/
$vars = array('forum_id', 'mode', 'row', 'topic_id');
extract($this->phpbb_dispatcher->trigger_event('core.feed_modify_feed_row', compact($vars)));
// BBCode options to correctly disable urls, smilies, bbcode...
if ($feed->get('options') === null) {
// Allow all combinations
$options = 7;
if ($feed->get('enable_bbcode') !== null && $feed->get('enable_smilies') !== null && $feed->get('enable_magic_url') !== null) {
$options = ($row[$feed->get('enable_bbcode')] ? OPTION_FLAG_BBCODE : 0) + ($row[$feed->get('enable_smilies')] ? OPTION_FLAG_SMILIES : 0) + ($row[$feed->get('enable_magic_url')] ? OPTION_FLAG_LINKS : 0);
}
} else {
$options = $row[$feed->get('options')];
}
$title = isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '' ? $row[$feed->get('title')] : (isset($row[$feed->get('title2')]) ? $row[$feed->get('title2')] : '');
$published = $feed->get('published') !== null ? (int) $row[$feed->get('published')] : 0;
$updated = $feed->get('updated') !== null ? (int) $row[$feed->get('updated')] : 0;
$display_attachments = $this->auth->acl_get('u_download') && $this->auth->acl_get('f_download', $row['forum_id']) && isset($row['post_attachment']) && $row['post_attachment'] ? true : false;
$item_row = array('author' => $feed->get('creator') !== null ? $row[$feed->get('creator')] : '', 'published' => $published > 0 ? $this->feed_helper->format_date($published) : '', 'updated' => $updated > 0 ? $this->feed_helper->format_date($updated) : '', 'link' => '', 'title' => censor_text($title), 'category' => $this->config['feed_item_statistics'] && !empty($row['forum_id']) ? $board_url . '/viewforum.' . $this->php_ext . '?f=' . $row['forum_id'] : '', 'category_name' => $this->config['feed_item_statistics'] && isset($row['forum_name']) ? $row['forum_name'] : '', 'description' => censor_text($this->feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], $display_attachments ? $feed->get_attachments($row['post_id']) : array())), 'statistics' => '');
// Adjust items, fill link, etc.
$feed->adjust_item($item_row, $row);
$item_vars[] = $item_row;
$feed_updated_time = max($feed_updated_time, $published, $updated);
}
// If we do not have any items at all, sending the current time is better than sending no time.
if (!$feed_updated_time) {
$feed_updated_time = time();
}
$feed->close();
$content = $this->template->render('feed.xml.twig', array('FEED_IMAGE' => '', 'SELF_LINK' => $this->controller_helper->route($this->request->attributes->get('_route'), $this->request->attributes->get('_route_params'), true, '', UrlGeneratorInterface::ABSOLUTE_URL), 'FEED_LINK' => $board_url . '/index.' . $this->php_ext, 'FEED_TITLE' => $this->config['sitename'], 'FEED_SUBTITLE' => $this->config['site_desc'], 'FEED_UPDATED' => $this->feed_helper->format_date($feed_updated_time), 'FEED_LANG' => $this->user->lang['USER_LANG'], 'FEED_AUTHOR' => $this->config['sitename'], 'FEED_ROWS' => $item_vars));
$response = new Response($content);
$response->headers->set('Content-Type', 'application/atom+xml');
$response->setCharset('UTF-8');
$response->setLastModified(new \DateTime('@' . $feed_updated_time));
if (!empty($this->user->data['is_bot'])) {
// Let reverse proxies know we detected a bot.
$response->headers->set('X-PHPBB-IS-BOT', 'yes');
}
return $response;
}
示例10: info
public function info($user_id)
{
if (!$this->auth->acl_gets('u_viewprofile')) {
trigger_error('NOT_AUTHORISED');
}
$sql_ary = array('SELECT' => 'u.username, u.user_colour, u.user_regdate, u.user_posts, u.user_lastvisit, u.user_rank, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'u.user_id = ' . (int) $user_id);
/**
* Modify SQL query in tas2580 AJAX userinfo extension
*
* @event tas2580.userinfo_modify_sql
* @var string sql_ary The SQL query
* @var int user_id The ID of the user
* @since 0.2.3
*/
$vars = array('sql_ary', 'user_id');
extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_sql', compact($vars)));
$result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), 1);
$this->data = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!function_exists('phpbb_get_user_rank')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
$user_rank_data = phpbb_get_user_rank($this->data, $this->data['user_posts']);
// Get the avatar
// Wen need to use the full URL here because we don't know the path where userinfo is called
define('PHPBB_USE_BOARD_URL_PATH', true);
$avatar = phpbb_get_user_avatar($this->data);
$avatar = empty($avatar) ? '<img src="' . generate_board_url() . '/styles/' . $this->user->style['style_name'] . '/theme/images/no_avatar.gif" width="100" height="100" alt="' . $this->user->lang('USER_AVATAR') . '">' : $avatar;
$memberdays = max(1, round((time() - $this->data['user_regdate']) / 86400));
$posts_per_day = $this->data['user_posts'] / $memberdays;
$percentage = $this->config['num_posts'] ? min(100, $this->data['user_posts'] / $this->config['num_posts'] * 100) : 0;
$result = array('userinfo_header' => sprintf($this->user->lang['VIEWING_PROFILE'], $this->data['username']), 'username' => get_username_string('no_profile', $user_id, $this->data['username'], $this->data['user_colour']), 'regdate' => $this->user->format_date($this->data['user_regdate']), 'posts' => $this->data['user_posts'], 'lastvisit' => $this->user->format_date($this->data['user_lastvisit']), 'avatar' => $avatar, 'rank' => empty($user_rank_data['title']) ? $this->user->lang('NA') : $user_rank_data['title'], 'postsperday' => $this->user->lang('POST_DAY', $posts_per_day), 'percentage' => $this->user->lang('POST_PCT', $percentage));
/**
* Modify return data in tas2580 AJAX userinfo extension
*
* @event tas2580.userinfo_modify_result
* @var array result The result array
* @var int user_id The ID of the user
* @since 0.2.3
*/
$vars = array('result', 'user_id');
extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_result', compact($vars)));
return new JsonResponse($result);
}
示例11: display_topic_preview
/**
* Inject topic preview text into the template
*
* @param array $row Row data
* @param array $block Template vars array
* @return array Template vars array
* @access public
*/
public function display_topic_preview($row, $block)
{
if (!$this->is_enabled()) {
return $block;
}
$block = array_merge($block, array('TOPIC_PREVIEW_FIRST_POST' => !empty($row['first_post_text']) ? censor_text($this->trim_tools->trim_text($row['first_post_text'], $this->config['topic_preview_limit'])) : '', 'TOPIC_PREVIEW_LAST_POST' => !empty($row['last_post_text']) && $row['topic_first_post_id'] != $row['topic_last_post_id'] ? censor_text($this->trim_tools->trim_text($row['last_post_text'], $this->config['topic_preview_limit'])) : '', 'TOPIC_PREVIEW_FIRST_AVATAR' => $this->get_user_avatar_helper($row, 'fp'), 'TOPIC_PREVIEW_LAST_AVATAR' => $this->get_user_avatar_helper($row, 'lp')));
$tp_avatars = $this->avatars_enabled();
/**
* EVENT to modify the topic preview display output before it gets inserted in the template block
*
* @event vse.topicpreview.display_topic_preview
* @var array row Row data
* @var array block Template vars array
* @var bool tp_avatars Display avatars setting
* @since 2.1.0
*/
$vars = array('row', 'block', 'tp_avatars');
extract($this->dispatcher->trigger_event('vse.topicpreview.display_topic_preview', compact($vars)));
return $block;
}
示例12: generate_profile_fields_template_data
/**
* Assign the user's profile fields data to the template
*
* @param array $profile_row Array with users profile field data
* @param bool $use_contact_fields Should we display contact fields as such?
* This requires special treatments (links should not be parsed in the values, and more)
* @return array
*/
public function generate_profile_fields_template_data($profile_row, $use_contact_fields = true)
{
// $profile_row == $user_fields[$row['user_id']];
$tpl_fields = array();
$tpl_fields['row'] = $tpl_fields['blockrow'] = array();
/**
* Event to modify data of the generated profile fields, before the template assignment loop
*
* @event core.generate_profile_fields_template_data_before
* @var array profile_row Array with users profile field data
* @var array tpl_fields Array with template data fields
* @var bool use_contact_fields Should we display contact fields as such?
* @since 3.1.0-b3
*/
$vars = array('profile_row', 'tpl_fields', 'use_contact_fields');
extract($this->dispatcher->trigger_event('core.generate_profile_fields_template_data_before', compact($vars)));
foreach ($profile_row as $ident => $ident_ary) {
$profile_field = $this->type_collection[$ident_ary['data']['field_type']];
$value = $profile_field->get_profile_value($ident_ary['value'], $ident_ary['data']);
$value_raw = $profile_field->get_profile_value_raw($ident_ary['value'], $ident_ary['data']);
if ($value === null) {
continue;
}
$field_desc = $contact_url = '';
if ($use_contact_fields && $ident_ary['data']['field_is_contact']) {
$value = $profile_field->get_profile_contact_value($ident_ary['value'], $ident_ary['data']);
$field_desc = $this->user->lang($ident_ary['data']['field_contact_desc']);
if (strpos($field_desc, '%s') !== false) {
$field_desc = sprintf($field_desc, $value);
}
$contact_url = '';
if (strpos($ident_ary['data']['field_contact_url'], '%s') !== false) {
$contact_url = sprintf($ident_ary['data']['field_contact_url'], $value);
}
}
$tpl_fields['row'] += array('PROFILE_' . strtoupper($ident) . '_IDENT' => $ident, 'PROFILE_' . strtoupper($ident) . '_VALUE' => $value, 'PROFILE_' . strtoupper($ident) . '_VALUE_RAW' => $value_raw, 'PROFILE_' . strtoupper($ident) . '_CONTACT' => $contact_url, 'PROFILE_' . strtoupper($ident) . '_DESC' => $field_desc, 'PROFILE_' . strtoupper($ident) . '_TYPE' => $ident_ary['data']['field_type'], 'PROFILE_' . strtoupper($ident) . '_NAME' => $this->user->lang($ident_ary['data']['lang_name']), 'PROFILE_' . strtoupper($ident) . '_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), 'S_PROFILE_' . strtoupper($ident) . '_CONTACT' => $ident_ary['data']['field_is_contact'], 'S_PROFILE_' . strtoupper($ident) => true);
$tpl_fields['blockrow'][] = array('PROFILE_FIELD_IDENT' => $ident, 'PROFILE_FIELD_VALUE' => $value, 'PROFILE_FIELD_VALUE_RAW' => $value_raw, 'PROFILE_FIELD_CONTACT' => $contact_url, 'PROFILE_FIELD_DESC' => $field_desc, 'PROFILE_FIELD_TYPE' => $ident_ary['data']['field_type'], 'PROFILE_FIELD_NAME' => $this->user->lang($ident_ary['data']['lang_name']), 'PROFILE_FIELD_EXPLAIN' => $this->user->lang($ident_ary['data']['lang_explain']), 'S_PROFILE_CONTACT' => $ident_ary['data']['field_is_contact'], 'S_PROFILE_' . strtoupper($ident) => true);
}
/**
* Event to modify template data of the generated profile fields
*
* @event core.generate_profile_fields_template_data
* @var array profile_row Array with users profile field data
* @var array tpl_fields Array with template data fields
* @var bool use_contact_fields Should we display contact fields as such?
* @since 3.1.0-b3
*/
$vars = array('profile_row', 'tpl_fields', 'use_contact_fields');
extract($this->dispatcher->trigger_event('core.generate_profile_fields_template_data', compact($vars)));
return $tpl_fields;
}
示例13: delete_thanks
public function delete_thanks($post_id, $forum_id)
{
// $this->user->add_lang_ext('gfksx/ThanksForPosts', 'thanks_mod');
$to_id = $this->request->variable('to_id', 0);
$forum_id = $forum_id ?: $this->request->variable('f', 0);
$row = $this->get_post_info($post_id);
// confirm
$hidden = build_hidden_fields(array('to_id' => $to_id, 'rthanks' => $post_id));
/**
* This event allows to interrupt before a thanks is deleted
*
* @event gfksx.thanksforposts.delete_thanks_before
* @var int post_id The post id
* @var int forum_id The forum id
* @since 2.0.3
*/
$vars = array('post_id', 'forum_id');
extract($this->phpbb_dispatcher->trigger_event('gfksx.thanksforposts.delete_thanks_before', compact($vars)));
if (isset($this->config['remove_thanks']) ? !$this->config['remove_thanks'] : true) {
trigger_error($this->user->lang['DISABLE_REMOVE_THANKS'] . '<br /><br />' . $this->user->lang('RETURN_POST', '<a href="' . append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&p={$post_id}#p{$post_id}") . '">', '</a>'));
}
if (confirm_box(true, 'REMOVE_THANKS', $hidden)) {
if ($this->user->data['user_type'] != USER_IGNORE && !empty($to_id) && $this->auth->acl_get('f_thanks', $forum_id)) {
$sql = "DELETE FROM " . $this->thanks_table . '
WHERE post_id =' . (int) $post_id . " AND user_id = " . (int) $this->user->data['user_id'];
$this->db->sql_query($sql);
$result = $this->db->sql_affectedrows($sql);
if ($result != 0) {
$lang_act = 'REMOVE';
$thanks_data = array('user_id' => (int) $this->user->data['user_id'], 'post_id' => $post_id, 'poster_id' => $to_id, 'topic_id' => (int) $row['topic_id'], 'forum_id' => $forum_id, 'thanks_time' => time(), 'username' => $this->user->data['username'], 'lang_act' => $lang_act, 'post_subject' => $row['post_subject']);
$this->add_notification($thanks_data, 'gfksx.thanksforposts.notification.type.thanks_remove');
if (isset($this->config['thanks_info_page']) && $this->config['thanks_info_page']) {
meta_refresh(1, append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&p={$post_id}#p{$post_id}"));
trigger_error($this->user->lang['THANKS_INFO_' . $lang_act] . '<br /><br />' . $this->user->lang('RETURN_POST', '<a href="' . append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&p={$post_id}#p{$post_id}") . '">', '</a>'));
} else {
redirect(append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&p={$post_id}#p{$post_id}"));
}
} else {
trigger_error($this->user->lang['INCORRECT_THANKS'] . '<br /><br />' . $this->user->lang('RETURN_POST', '<a href="' . append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&p={$post_id}#p{$post_id}") . '">', '</a>'));
}
}
} else {
confirm_box(false, 'REMOVE_THANKS', $hidden);
redirect(append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", "f={$forum_id}&p={$post_id}#p{$post_id}"));
}
return;
}
示例14: mark_unsolved
/**
* Marks a topic as unsolved.
*
* @param array $topic_data Topic to be marked as unsolved.
*/
public function mark_unsolved($topic_data)
{
// Database column values to set.
$column_data = array('topic_solved' => 0);
if ($topic_data['forum_lock_solved'] && $this->auth->acl_get('m_lock', $topic_data['forum_id'])) {
$column_data['topic_status'] = ITEM_UNLOCKED;
}
$this->update_topic($topic_data['topic_id'], $column_data);
/**
* This event allows you to perform additional actions after a topic has been marked as unsolved.
*
* @event tierra.topicsolved.mark_unsolved_after
* @var array topic_data Array with general topic data
* @var array column_data Array with topic data that the database has been updated with
* @since 2.2.0
*/
$vars = array('topic_data', 'column_data');
extract($this->dispatcher->trigger_event('tierra.topicsolved.mark_unsolved_after', compact($vars)));
}
示例15: delete
/**
* {@inheritdoc}
*/
public function delete($row)
{
$error = array();
$destination = $this->config['avatar_path'];
$prefix = $this->config['avatar_salt'] . '_';
$ext = substr(strrchr($row['avatar'], '.'), 1);
$filename = $this->phpbb_root_path . $destination . '/' . $prefix . $row['id'] . '.' . $ext;
/**
* Before deleting an existing avatar
*
* @event core.avatar_driver_upload_delete_before
* @var string destination Destination directory where the file is going to be deleted
* @var string prefix Prefix for the avatar filename
* @var array row Array with avatar row data
* @var array error Array of errors, if filled in by this event file will not be deleted
* @since 3.1.6-RC1
*/
$vars = array('destination', 'prefix', 'row', 'error');
extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars)));
if (!sizeof($error) && file_exists($filename)) {
@unlink($filename);
}
return true;
}