本文整理汇总了PHP中phpbb\user::add_lang_ext方法的典型用法代码示例。如果您正苦于以下问题:PHP user::add_lang_ext方法的具体用法?PHP user::add_lang_ext怎么用?PHP user::add_lang_ext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\user
的用法示例。
在下文中一共展示了user::add_lang_ext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public function main($id, $mode)
{
global $config, $request, $template, $user;
$this->config = $config;
$this->request = $request;
$this->template = $template;
$this->user = $user;
// Add the common lang file
$this->user->add_lang(array('acp/common'));
// Add the board snowstormlights ACP lang file
$this->user->add_lang_ext('prosk8er/snowstormlights', 'info_acp_snowstorm_lights');
// Load a template from adm/style for our ACP page
$this->tpl_name = 'snowstorm_lights';
// Set the page title for our ACP page
$this->page_title = $user->lang['ACP_SNOWSTORM_LIGHTS'];
// Define the name of the form for use as a form key
$form_key = 'acp_snowstorm_lights';
add_form_key($form_key);
// If form is submitted or previewed
if ($this->request->is_set_post('submit')) {
// Test if form key is valid
if (!check_form_key($form_key)) {
trigger_error('FORM_INVALID');
}
// Store the config enable/disable state
$scl_enabled = $this->request->variable('scl_enabled', 0);
$this->config->set('scl_enabled', $scl_enabled);
$snow_enabled = $request->variable('snow_enabled', 0);
$this->config->set('snow_enabled', $snow_enabled);
// Output message to user for the update
trigger_error($this->user->lang('SNOWSTORM_LIGHTS_SAVED') . adm_back_link($this->u_action));
}
// Output data to the template
$this->template->assign_vars(array('SCL_ENABLED' => isset($this->config['scl_enabled']) ? $this->config['scl_enabled'] : '', 'SNOW_ENABLED' => isset($this->config['snow_enabled']) ? $this->config['snow_enabled'] : '', 'U_ACTION' => $this->u_action));
}
示例2: main
public function main($id, $mode)
{
global $config, $request, $template, $user;
$this->config = $config;
$this->request = $request;
$this->template = $template;
$this->user = $user;
$this->user->add_lang('acp/common');
$this->user->add_lang_ext('phpbbmodders/holidayflare', 'holidayflare_acp');
$this->tpl_name = 'acp_holidayflare';
$this->page_title = $this->user->lang('ACP_HOLIDAYFLARE');
$form_key = 'acp_holidayflare';
add_form_key($form_key);
if ($this->request->is_set_post('submit')) {
if (!check_form_key($form_key)) {
trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
}
/* XMAS Start */
$enable_xmas = $this->request->variable('enable_xmas', 0);
$this->config->set('enable_xmas', $enable_xmas);
/* XMAS Stop */
/* Valentine Start */
$enable_valentine = $this->request->variable('enable_valentine', 0);
$this->config->set('enable_valentine', $enable_valentine);
/* Valentine Stop */
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
}
$this->template->assign_vars(array('S_ENABLE_XMAS' => isset($this->config['enable_xmas']) ? $this->config['enable_xmas'] : '', 'S_ENABLE_VALENTINE' => isset($this->config['enable_valentine']) ? $this->config['enable_valentine'] : '', 'U_ACTION' => $this->u_action));
}
示例3: like_post
/**
* Likes controller for route /like_post/{like}
*
* @param int @post_id The post to be edited.
*/
public function like_post($post_id)
{
// If unknown user or bot, cannot like.
if ($this->user->data['user_id'] == ANONYMOUS || $this->user->data['is_bot']) {
return;
}
// Add language variables for response.
$this->user->add_lang_ext('nuleaf/likes', 'likes');
// Grab forum id for permission.
$sql = 'SELECT forum_id
FROM ' . POSTS_TABLE . '
WHERE post_id = ' . $post_id;
$result = $this->db->sql_query_limit($sql, 1);
$forum_id = $this->db->sql_fetchrow($result)['forum_id'];
$this->db->sql_freeresult($result);
// Does the user have permission to like posts in this forum?
if ($this->auth->acl_get('!f_like', $forum_id)) {
$json_response = new json_response();
$json_response->send(array('error' => $this->user->lang('LIKE_NOT_AUTHORIZED')));
return;
}
if ($this->request->is_ajax()) {
$liked = $this->likes_manager->is_liked($post_id);
if ($liked) {
// If post is already liked, unlike it.
$likes_count = $this->likes_manager->unlike($post_id);
} else {
// Else like the post.
$likes_count = $this->likes_manager->like($post_id);
}
// Since the post has now been liked/unliked, $liked is reversed.
$json_response = new json_response();
$json_response->send(array('likes_count' => $likes_count, 'liked' => !$liked, 'LIKE_POST' => $this->user->lang('LIKE_POST'), 'UNLIKE_POST' => $this->user->lang('UNLIKE_POST'), 'LIKE_BUTTON' => $this->user->lang('LIKE_BUTTON'), 'UNLIKE_BUTTON' => $this->user->lang('UNLIKE_BUTTON')));
}
}
示例4: __construct
/**
* Constructor
*
* @param \phpbb\config\config $config
* @param \phpbb\request\request_interface $request
* @param \phpbb\user $user
*/
public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user)
{
$this->config = $config;
$this->request = $request;
$this->user = $user;
$this->user->add_lang_ext('AJHenderson/BattleNetOAuthUS', 'common');
}
示例5: page
/**
* Controller for route /paypal
*
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
*/
public function page()
{
$this->user->add_lang_ext('tas2580/paypal', 'common');
$amount_list = '';
$sql = 'SELECT *
FROM ' . $this->table_amount . '
ORDER BY amount_value';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$amount_list .= '<option value="' . number_format($row['amount_value'] / 100, 2) . '">' . number_format($row['amount_value'] / 100, 2) . '</option>';
}
$sql = 'SELECT *
FROM ' . $this->table_items . '
ORDER BY item_name';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('items', array('ITEM_NAME' => $row['item_name'], 'ITEM' => generate_text_for_display($row['item_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'ITEM_ID' => $row['item_id']));
}
$sql = 'SELECT *
FROM ' . $this->table_config;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->template->assign_vars(array('PAYPAL_TITLE' => $row['paypal_title'], 'PAYPAL_TEXT' => generate_text_for_display($row['paypal_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'PAYPAL_EMAIL' => $row['paypal_email'], 'AMOUNT_LIST' => $amount_list, 'PAYPAL_ACTION' => $row['paypal_sandbox'] == 1 ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', 'S_SANDBOX' => $row['paypal_sandbox'] == 1 ? true : false, 'S_CURL' => function_exists('curl_init'), 'CURRENCY_CODE' => $this->currency_code_select($row['paypal_currency']), 'CURRENCY' => $row['paypal_currency'], 'USER_ID' => $this->user->data['user_id'], 'IPN_URL' => $this->helper->route('tas2580_paypal_ipn', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL), 'RETURN_URL' => $this->helper->route('tas2580_paypal_controller', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL)));
return $this->helper->render('paypal_body.html', $row['paypal_title']);
}
示例6: display_24_hour_stats
/**
* Display stats on index page
*
* @param object $event The event object
* @return null
* @access public
*/
public function display_24_hour_stats($event)
{
// if the user is a bot
if ($this->user->data['is_bot']) {
return;
}
$this->user->add_lang_ext('rmcgirr83/activity24hours', 'common');
// obtain posts/topics/new users activity
$activity = $this->obtain_activity_data();
// obtain user activity data
$active_users = $this->obtain_active_user_data();
// Obtain guests data
$total_guests_online_24 = $this->obtain_guest_count_24();
$user_count = 0;
foreach ((array) $active_users as $row) {
if (!$row['session_viewonline'] && !empty($row['session_time']) || !$row['user_allow_viewonline']) {
if ($this->auth->acl_get('u_viewonline') || $row['user_id'] === $this->user->data['user_id']) {
$row['username'] = '<em>' . $row['username'] . '</em>';
} else {
continue;
}
}
if ($row['user_lastvisit'] < $this->interval && $row['session_time'] < $this->interval) {
continue;
}
$max_last_visit = max($row['user_lastvisit'], $row['session_time']);
$hover_info = ' title="' . $this->user->format_date($max_last_visit) . '"';
++$user_count;
$this->template->assign_block_vars('lastvisit', array('USERNAME_FULL' => '<span' . $hover_info . '>' . get_username_string($row['user_type'] == USER_IGNORE ? 'no_profile' : 'full', $row['user_id'], $row['username'], $row['user_colour']) . '</span>'));
}
// assign the forum stats to the template.
$this->template->assign_vars(array('USERS_24HOUR_TOTAL' => $this->user->lang('USERS_24HOUR_TOTAL', $user_count), 'USERS_ACTIVE' => $user_count, 'GUEST_ONLINE_24' => $this->config['load_online_guests'] ? $this->user->lang('GUEST_ONLINE_24', $total_guests_online_24) : '', 'HOUR_TOPICS' => $this->user->lang('24HOUR_TOPICS', $activity['topics']), 'HOUR_POSTS' => $this->user->lang('24HOUR_POSTS', $activity['posts']), 'HOUR_USERS' => $this->user->lang('24HOUR_USERS', $activity['users']), 'S_CAN_VIEW_24_HOURS' => true));
}
示例7: memberlist_view_profile
/**
* Display zodiac on viewing user profile
*
* @param object $event The event object
* @return null
* @access public
*/
public function memberlist_view_profile($event)
{
$user_id = $event['member']['user_id'];
$reg_date = $event['member']['user_regdate'];
$this->user->add_lang_ext('rmcgirr83/searchusertopics', 'common');
// get all topics started by the user and make sure they are visible
$sql = 'SELECT t.*, p.post_visibility
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
WHERE t.topic_poster = ' . $user_id . '
ORDER BY t.topic_time ASC';
$result = $this->db->sql_query($sql);
$topics_num = 0;
while ($row = $this->db->sql_fetchrow($result)) {
if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
continue;
}
++$topics_num;
}
$this->db->sql_freeresult($result);
if ($topics_num) {
// Do the relevant calculations
$users_days = max(1, round((time() - $reg_date) / 86400));
$topics_per_day = $topics_num / $users_days;
$topics_percent = $this->config['num_topics'] ? min(100, $topics_num / $this->config['num_topics'] * 100) : 0;
$this->template->assign_vars(array('TOPICS' => $topics_num, 'L_TOTAL_TOPICS' => $this->user->lang('TOTAL_TOPICS', $topics_num), 'TOPICS_PER_DAY' => $this->user->lang('TOPICS_PER_DAY', $topics_per_day), 'TOPICS_PERCENT' => $this->user->lang('TOPICS_PERCENT', $topics_percent), 'U_SEARCH_TOPICS' => $this->auth->acl_get('u_search') ? append_sid("{$this->root_path}search.{$this->php_ext}", "author_id={$user_id}&sr=topics&sf=firstpost") : ''));
}
}
示例8: acp_ranks_list_modify_rank_row
public function acp_ranks_list_modify_rank_row($event)
{
$this->user->add_lang_ext('paybas/rankpoststyling', 'rankpoststyling');
$rank_row = $event['rank_row'];
$rank_row['RANK_STYLE'] = isset($event['row']['rank_style']) ? $event['row']['rank_style'] : '';
$event['rank_row'] = $rank_row;
}
示例9: memberlist_view_profile
/**
* Display zodiac on viewing user profile
*
* @param object $event The event object
* @return null
* @access public
*/
public function memberlist_view_profile($event)
{
$user_id = $event['member']['user_id'];
$this->user->add_lang_ext('rmcgirr83/topicsbyuser', 'common');
// get all topics started by the user and make sure they are visible
$sql = 'SELECT t.*, p.post_visibility
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
WHERE t.topic_poster = ' . $user_id . '
ORDER BY t.topic_time ASC';
$result = $this->db->sql_query($sql);
$count = 0;
$topic_options = '<option value="">' . $this->user->lang['CHOOSE_A_TOPIC'] . '</option>';
while ($row = $this->db->sql_fetchrow($result)) {
if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
continue;
}
++$count;
$topic_color = $row['post_visibility'] != ITEM_APPROVED ? 'class="error"' : '';
$topic_options .= '<option value="' . append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']) . '" ' . $topic_color . '> ' . truncate_string($row['topic_title'], 30, 255, false, $this->user->lang['ELLIPSIS']) . '</option>';
}
$this->db->sql_freeresult($result);
if (!empty($count)) {
$this->template->assign_vars(array('HAS_TOPICS' => true, 'S_TOPIC_OPTIONS' => $topic_options));
}
}
示例10: ucp_prefs_get_data
public function ucp_prefs_get_data($event)
{
// Request the user option vars and add them to the data array
$event['data'] = array_merge($event['data'], array('rt_enable' => $this->request->variable('rt_enable', (int) $this->user->data['user_rt_enable']), 'rt_alt_location' => $this->request->variable('rt_alt_location', (int) $this->user->data['user_rt_alt_location']), 'rt_sort_start_time' => $this->request->variable('rt_sort_start_time', (int) $this->user->data['user_rt_sort_start_time']), 'rt_unread_only' => $this->request->variable('rt_unread_only', (int) $this->user->data['user_rt_unread_only'])));
// Output the data vars to the template (except on form submit)
if (!$event['submit'] && $this->auth->acl_get('u_rt_view')) {
$this->user->add_lang_ext('paybas/recenttopics', 'recenttopics_ucp');
$template_vars = array();
if ($this->auth->acl_get('u_rt_enable') || $this->auth->acl_get('u_rt_alt_location') || $this->auth->acl_get('u_rt_sort_start_time') || $this->auth->acl_get('u_rt_unread_only')) {
$template_vars += array('S_RT_SHOW' => true);
}
if ($this->auth->acl_get('u_rt_enable')) {
$template_vars += array('A_RT_ENABLE' => true, 'S_RT_ENABLE' => $event['data']['rt_enable']);
}
if ($this->auth->acl_get('u_rt_alt_location')) {
$template_vars += array('A_RT_ALT_LOCATION' => true, 'S_RT_ALT_LOCATION' => $event['data']['rt_alt_location']);
}
if ($this->auth->acl_get('u_rt_sort_start_time')) {
$template_vars += array('A_RT_SORT_START_TIME' => true, 'S_RT_SORT_START_TIME' => $event['data']['rt_sort_start_time']);
}
if ($this->auth->acl_get('u_rt_unread_only')) {
$template_vars += array('A_RT_UNREAD_ONLY' => true, 'S_RT_UNREAD_ONLY' => $event['data']['rt_unread_only']);
}
$this->template->assign_vars($template_vars);
}
}
示例11: main
public function main($event)
{
if ($this->config['load_birthdays'] && $this->config['allow_birthdays'] && $this->config['allow_birthdays_ahead'] > 0 && $this->auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) {
$this->user->add_lang_ext('rmcgirr83/upcomingbirthdays', 'upcomingbirthdays');
$this->upcoming_birthdays();
}
}
示例12: main
public function main($event)
{
// add lang file
$this->user->add_lang_ext('v12mike/postoftheday', 'postoftheday');
$this->functions->topposts();
$this->template->assign_vars(array('S_POSTOFTHEDAY' => 1, 'S_POSTOFTHEDAY_LOCATION' => $this->config['post_of_the_day_location']));
}
示例13: page_header_after
public function page_header_after($event)
{
if (!empty($this->config['phpbbde_contactform_forum_id'])) {
$this->user->add_lang_ext('phpbbde/contactform', 'global');
$this->template->assign_vars(array('U_CONTACTFORM' => $this->helper->route('phpbbde_contactform_main_controller')));
}
}
示例14: setup
/**
* Setup Smart Subjects
*
* @param \phpbb\event\data $event The event object
* @return void
*/
public function setup($event)
{
$this->user->add_lang_ext('vse/smartsubjects', 'smartsubjects');
$page_data = $event['page_data'];
$page_data['S_SMART_SUBJECTS_MOD'] = $this->forum_auth($event['forum_id']) && $this->auth->acl_get('m_', $event['forum_id']);
$event['page_data'] = $page_data;
}
示例15: article
/**
* Display an article
*
* @param string $article URL of the article
* @return object
*/
public function article($article)
{
$this->user->add_lang_ext('tas2580/wiki', 'common');
if (!$this->auth->acl_get('u_wiki_view')) {
trigger_error('NOT_AUTHORISED');
}
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['WIKI'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_index', array())));
$this->template->assign_vars(array('WIKI_FOOTER' => $this->user->lang('WIKI_FOOTER', base64_decode('aHR0cHM6Ly90YXMyNTgwLm5ldA=='), base64_decode('dGFzMjU4MA=='))));
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
$action = $this->request->variable('action', '');
$id = $this->request->variable('id', 0);
switch ($action) {
case 'edit':
return $this->edit->edit_article($article);
case 'versions':
return $this->compare->view_versions($article);
case 'compare':
$from = $this->request->variable('from', 0);
$to = $this->request->variable('to', 0);
return $this->compare->compare_versions($article, $from, $to);
case 'delete':
return $this->delete->version($id);
case 'detele_article':
return $this->delete->article($article);
case 'active':
return $this->edit->active($id);
case 'deactivate':
return $this->edit->deactivate($article);
default:
return $this->view->view_article($article, $id);
}
}