本文整理汇总了PHP中phpbb\auth\auth类的典型用法代码示例。如果您正苦于以下问题:PHP auth类的具体用法?PHP auth怎么用?PHP auth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了auth类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
}
示例2: handle_downloadlog
public function handle_downloadlog()
{
if (!$this->auth->acl_get('a_')) {
trigger_error('Access Denied');
} else {
$this->user->add_lang_ext('dmzx/downloadlog', 'common');
$fileid = $this->request->variable('file', 0);
$start = $this->request->variable('start', 0);
// Pagination number from ACP
$dll = $this->config['downloadlog_value'];
// Generate pagination
$sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs
FROM ' . $this->userdownloadslog_table . '
WHERE user_id = user_id
AND file_id = ' . $fileid;
$result = $this->db->sql_query($sql);
$total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs');
$sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u
WHERE u.user_id = d.user_id
AND file_id = ' . $fileid . '
ORDER BY d.down_date DESC';
$top_result = $this->db->sql_query_limit($sql, $dll, $start);
while ($row = $this->db->sql_fetchrow($top_result)) {
$this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date'])));
}
}
$pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid));
//Start pagination
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start);
$this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version']));
page_header('Downloaders Log', false);
$this->template->set_filenames(array('body' => 'DownloadLog.html'));
page_footer();
}
示例3: 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();
}
}
示例4: page_header
public function page_header($event)
{
if ($this->auth->acl_get('u_did_you_know')) {
$sql_layer = $this->db->get_sql_layer();
switch ($sql_layer) {
case 'postgres':
$random = 'RANDOM()';
break;
case 'mssql':
case 'mssql_odbc':
$random = 'NEWID()';
break;
default:
$random = 'RAND()';
break;
}
$sql = 'SELECT word, bbcode_uid, bbcode_bitfield, bbcode_options
FROM ' . $this->did_you_know . "\n\t\t\t\tWHERE lang_iso = '{$this->user->data['user_lang']}'\n\t\t\t\t\tOR lang_iso = 'default'\n\t\t\t\tORDER BY {$random}";
$result = $this->db->sql_query_limit($sql, 1);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
$word = generate_text_for_display($row['word'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
$this->template->assign_vars(array('DID_YOU_KNOW' => str_replace(""", '"', $word), 'S_DIDYOUKNOW' => !empty($this->user->data['user_didyouknow']) ? true : false, 'U_DYK_HIDE' => $this->helper->route('dmzx_didyouknow_controller', array('mode' => 'hide'))));
}
}
示例5: modify_profile_info
/**
* Allow to change their colour
*
* @param object $event The event object
* @return null
* @access public
*/
public function modify_profile_info($event)
{
$this->user->add_lang_ext('dmzx/usernamecolourchanger', 'common');
// Request the user option vars and add them to the data array
$event['data'] = array_merge($event['data'], array('user_colour' => $this->request->variable('user_colour', $this->user->data['user_colour'], true)));
$this->template->assign_vars(array('COLOUR' => $event['data']['user_colour'], 'USE_USERNAMECOLOURCHANGER' => $this->auth->acl_get('u_usernamecolourchanger_use')));
}
示例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: viewtopic_modify_page_title
/**
* Only display quick reply for admins and mods
*
* @param object $event The event object
* @return null
* @access public
*/
public function viewtopic_modify_page_title($event)
{
$is_authed = $this->auth->acl_gets('a_', 'm_');
if (!$is_authed) {
$this->template->assign_vars(array('S_QUICK_REPLY' => false));
}
}
示例8: prepare_user_reputation_data
/**
* Display user reputation on user profile page
*
* @param object $event The event object
* @return null
* @access public
*/
public function prepare_user_reputation_data($event)
{
$data = $event['data'];
$template_data = $event['template_data'];
$template_data = array_merge($template_data, array('USER_REPUTATION' => $data['user_reputation'], 'U_VIEW_USER_REPUTATION' => $this->helper->route('reputation_details_controller', array('uid' => $data['user_id'])), 'U_RATE_USER' => $this->helper->route('reputation_user_rating_controller', array('uid' => $data['user_id'])), 'U_REPUTATION_REFERER' => $this->helper->get_current_url(), 'S_RATE_USER' => $this->config['rs_user_rating'] && $this->auth->acl_get('u_rs_rate') ? true : false, 'S_VIEW_REPUTATION' => $this->auth->acl_get('u_rs_view') ? true : false));
$event['template_data'] = $template_data;
}
示例9: delete_post
/**
* Delete a shoutbox post
*
* @param int $id
*
* @throws \paul999\ajaxshoutbox\exceptions\shoutbox_exception
*/
public function delete_post($id)
{
if (!$id) {
$id = $this->request->variable('id', 0);
}
$sql = 'SELECT user_id FROM ' . $this->table . ' WHERE shout_id = ' . (int) $id;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow();
$this->db->sql_freeresult($result);
if (!$row) {
throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
}
if (!$this->auth->acl_get('m_shoutbox_delete')) {
// User has no m_ permission.
if ($row['user_id'] != $this->user->data['user_id']) {
throw new shoutbox_exception('AJAX_SHOUTBOX_NO_SUCH_POST');
}
if (!$this->auth->acl_get('u_shoutbox_delete')) {
throw new shoutbox_exception('AJAX_SHOUTBOX_NO_PERMISSION');
}
}
if ($this->push->canPush()) {
if ($this->push->delete($id) === false) {
throw new shoutbox_exception('AJAX_SHOUTBOX_PUSH_NOT_AVAIL');
}
}
$sql = 'DELETE FROM ' . $this->table . ' WHERE shout_id = ' . (int) $id;
$this->db->sql_query($sql);
}
示例10: 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);
}
}
示例11: display
/**
* Display the user ranks page
*
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
* @access public
*/
public function display($name)
{
// Get the rank details
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
ORDER BY rank_special DESC, rank_min ASC, rank_title ASC';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
if ($this->config['userranks_special'] || $this->config['userranks_special_admin'] && $this->auth->acl_get('a_') || !$this->config['userranks_special'] && !$row['rank_special']) {
$rank_row = array('S_RANK_IMAGE' => $row['rank_image'] ? true : false, 'S_SPECIAL_RANK' => $row['rank_special'] ? true : false, 'RANK_IMAGE' => $this->path_helper->get_web_root_path() . $this->config['ranks_path'] . '/' . $row['rank_image'], 'RANK_TITLE' => $row['rank_title'], 'MIN_POSTS' => $row['rank_min']);
$this->template->assign_block_vars('ranks', $rank_row);
// Are we displaying members?
if ($this->config['userranks_members'] || $this->config['userranks_members_admin'] && $this->auth->acl_get('a_')) {
$rank_users = $this->get_user_rank_data($row['rank_id']);
if (sizeof($rank_users) > 0) {
foreach ($rank_users as $row_rank) {
$this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => get_username_string('full', $row_rank['user_id'], $row_rank['username'], $row_rank['user_colour'])));
}
} else {
$this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => $this->user->lang('NO_MEMBERS')));
}
}
}
}
$this->db->sql_freeresult($result);
// Assign breadcrumb template vars for the user ranks page
$this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('david63_userranks_main_controller', array('name' => 'ranks')), 'FORUM_NAME' => $this->user->lang('USER_RANKS')));
// Send all data to the template file
return $this->helper->render('user_ranks.html', $name);
}
示例12: hide_bbcode
public function hide_bbcode($event)
{
global $request;
$fid = $request->variable('f', 0);
$sql_ary = $event['sql_ary'];
$auto = 0;
$autom = $this->auth->acl_get('m_', $fid);
$autoa = $this->auth->acl_get('a_', $fid);
if ($autom) {
$auto = 1;
}
if ($autoa) {
$auto = 2;
}
switch ($auto) {
case 0:
$sql_ary['WHERE'] = "b.display_on_posting = 1 AND b.lmdi = 0";
break;
case 1:
$sql_ary['WHERE'] = "b.display_on_posting = 1 AND (b.lmdi = 0 OR b.lmdi = 1)";
break;
case 2:
$sql_ary['WHERE'] = "b.display_on_posting = 1 AND (b.lmdi = 0 OR b.lmdi = 2)";
break;
}
$event['sql_ary'] = $sql_ary;
}
示例13: page_header
/**
* Add link to header
*
* @param object $event The event object
* @return null
* @access public
*/
public function page_header($event)
{
if ($this->auth->acl_get('u_usermap_view')) {
$this->user->add_lang_ext('tas2580/usermap', 'link');
$this->template->assign_vars(array('U_USERMAP' => $this->helper->route('tas2580_usermap_index', array())));
}
}
示例14: 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);
}
}
示例15: 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") : ''));
}
}