作者:rmcgirr8
项目:phpBB-3.1-topicsbyuse
/**
* 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));
}
}
作者:phpbb-e
项目:Downloadlo
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();
}
作者:alhitar
项目:phpBB-3.1-upcomingbirthday
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();
}
}
作者:phpbb-e
项目:Did-You-Kno
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'))));
}
}
作者:rmcgirr8
项目:Username-Colour-Change
/**
* 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')));
}
作者:rmcgirr8
项目:phpBB-3.1-activity24hour
/**
* 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));
}
作者:rmcgirr8
项目:phpBB-3.1-qradminsandmod
/**
* 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));
}
}
作者:rampmaste
项目:phpBB-Reputation-Syste
/**
* 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;
}
作者:alhitar
项目:ajax-shoutbox-ex
/**
* 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);
}
作者:tas258
项目:wik
/**
* 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);
}
}
作者:Galixt
项目:david63-userrank
/**
* 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);
}
作者:pierrd
项目:lmdi_hidebbcod
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;
}
作者:phpbb-addon
项目:userma
/**
* 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())));
}
}
作者:nachtel
项目:RecentTopic
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);
}
}
作者:TWEagl
项目:phpBB-3.1-searchusertopic
/**
* 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") : ''));
}
}
作者:NuLea
项目:nuleaf-foru
/**
* 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')));
}
}
作者:Sajak
项目:BreadcrumbMen
/**
* Modified version of the jumpbox, just lists authed forums (in the correct order)
*/
function get_forum_list($ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false)
{
// This query is identical to the jumpbox one
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $this->db->sql_query($sql, 600);
// We include the forum root/index to make tree traversal easier
$forum_list[0] = array('forum_id' => '0', 'forum_name' => $this->user->lang['FORUMS'], 'forum_type' => '0', 'link' => append_sid("{$this->root_path}index.{$this->phpEx}"), 'parent_id' => false, 'current' => false, 'current_child' => false, 'disabled' => false);
// Sometimes it could happen that forums will be displayed here not be displayed within the index page
// This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions.
// If this happens, the padding could be "broken"
while ($row = $this->db->sql_fetchrow($result)) {
$disabled = false;
if (!$ignore_acl && $this->auth->acl_gets(array('f_list', 'f_read'), $row['forum_id'])) {
if ($only_acl_post && !$this->auth->acl_get('f_post', $row['forum_id']) || !$this->auth->acl_get('m_approve', $row['forum_id']) && !$this->auth->acl_get('f_noapprove', $row['forum_id'])) {
$disabled = true;
}
} else {
if (!$ignore_acl) {
continue;
}
}
if (is_array($ignore_id) && in_array($row['forum_id'], $ignore_id) || $row['forum_id'] == $ignore_id || $row['forum_type'] == FORUM_CAT && $row['left_id'] + 1 == $row['right_id'] && $ignore_emptycat || $row['forum_type'] != FORUM_POST && $ignore_nonpost) {
$disabled = true;
}
$u_viewforum = append_sid("{$this->root_path}viewforum.{$this->phpEx}", 'f=' . $row['forum_id']);
$forum_list[$row['forum_id']] = array('forum_id' => $row['forum_id'], 'forum_name' => $row['forum_name'], 'forum_type' => $row['forum_type'], 'link' => $u_viewforum, 'parent_id' => $row['parent_id'], 'current' => false, 'current_child' => false, 'disabled' => $disabled);
}
$this->db->sql_freeresult($result);
return $forum_list;
}
作者:tas258
项目:wik
/**
* Display the edit form
*
* @param bool $preview
*/
protected function display_edit_form($preview = false)
{
generate_smilies('inline', 0);
display_custom_bbcodes();
add_form_key('article');
$this->template->assign_vars(array('S_PREVIEW' => $preview, 'TITLE' => $this->data['article_title'], 'MESSAGE' => $preview ? $this->data['article_text'] : $this->message_parser->message, 'PREVIEW_MESSAGE' => $this->message_parser->message, 'SOURCES' => $this->data['article_sources'], 'S_BBCODE_ALLOWED' => $this->option['bbcode'], 'S_LINKS_ALLOWED' => $this->option['url'], 'S_BBCODE_IMG' => $this->option['img'], 'S_BBCODE_FLASH' => $this->option['flash'], 'S_BBCODE_QUOTE' => $this->option['quote'], 'BBCODE_STATUS' => $this->option['bbcode'] ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->option['img'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $this->option['flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $this->option['smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->option['bbcode'] && $this->option['url'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'EDIT_REASON' => $this->data['article_edit_reason'], 'TOPIC_ID' => (int) $this->data['article_topic_id'], 'S_AUTH_ACTIVATE' => $this->auth->acl_get('u_wiki_set_active'), 'S_AUTH_EDIT_TOPIC' => $this->auth->acl_get('u_wiki_edit_topic'), 'S_AUTH_REDIRECT' => $this->auth->acl_get('u_wiki_set_redirect'), 'S_AUTH_STICKY' => $this->auth->acl_get('u_wiki_set_sticky'), 'S_ACTIVE' => $preview ? $this->data['article_approved'] : 1, 'S_STICKY' => $this->data['article_sticky'], 'ARTICLE_REDIRECT' => $this->data['article_redirect'], 'ARTICLE_DESCRIPTION' => $this->data['article_description']));
}
作者:sujith8
项目:phpBB-Extension-Codebox-Plu
/**
* @param $id post_id
* @param $part Code part
* @return mixed Render output to the template
**/
public function downloader($id = 0, $part = 0)
{
$id = (int) $id;
// If download function was disabled
if (!$this->enable_download) {
$this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_DOWNLOAD_DISABLED']);
return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
}
// Prevent bots
if ($this->enable_prevent_bots && $this->user->data['is_bot']) {
redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
}
// Check permission
$sql = 'SELECT forum_id FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $id;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
$this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_NO_PERMISSION']);
return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
}
// Login to download
if ($this->enable_login_required && !$this->user->data['is_registered']) {
login_box($this->helper->route('o0johntam0o_codeboxplus_download_controller', array('id' => $id, 'part' => $part)), $this->user->lang['CODEBOX_PLUS_ERROR_LOGIN_REQUIRED']);
}
// Captcha
if ($this->enable_captcha) {
$tmp_captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$tmp_captcha->init(CONFIRM_LOGIN);
$ok = false;
if ($this->request->is_set_post('submit')) {
$tmp_captcha->validate();
if ($tmp_captcha->is_solved()) {
$tmp_captcha->reset();
$ok = true;
}
}
// If the form was not submitted yet or the CAPTCHA was not solved
if (!$ok) {
// Too many request...
if ($tmp_captcha->get_attempt_count() >= $this->max_attempt) {
$this->template->assign_var('S_CODEBOX_PLUS_ERROR', $this->user->lang['CODEBOX_PLUS_ERROR_CONFIRM']);
return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
}
$this->template->assign_vars(array('S_CODE_DOWNLOADER_ACTION' => $this->helper->route('o0johntam0o_codeboxplus_download_controller', array('id' => $id, 'part' => $part)), 'S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $tmp_captcha->get_template()));
return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
} else {
// Downloading
$this->codebox_output($id, $part);
garbage_collection();
return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
//exit_handler();
}
} else {
// Downloading
$this->codebox_output($id, $part);
return $this->helper->render('codebox_plus.html', $this->user->lang['CODEBOX_PLUS_DOWNLOAD']);
}
}
作者:dmz
项目:Nivo-Slide
public function base()
{
if (!$this->auth->acl_get('a_')) {
return $this->settings->finish('SLIDER_INVALID_LOGIN', 400, 4, 'slider_home');
}
$this->slider_settings();
return $this->helper->render('nivoslider.html', 'Options Panel');
}