Karma MOD für phpBB3.0.4?

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 3.0 hat das Ende seiner Lebenszeit überschritten
phpBB 3.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 3.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf die neuste phpBB-Version, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
paulpokemon
Mitglied
Beiträge: 58
Registriert: 25.04.2008 14:54

Karma MOD für phpBB3.0.4?

Beitrag von paulpokemon »

Hallo

Lieder geht der karma mod nur in phbb3.0.1 ich wolte fragen
was man ändern muss damit er auf 3.0.4 läuft


KARMA MOD: http://www.phpbb.com/community/viewtopi ... 0&t=559069


MFG
Benutzeravatar
Dr.Death
Moderator
Moderator
Beiträge: 17473
Registriert: 23.04.2003 08:22
Wohnort: Xanten
Kontaktdaten:

Beitrag von Dr.Death »

Hallo,

da musst Du den Author des MODs fragen.

Aber dieser MOD wurde "eingestampft" und wird vom ursprünglichen Author nicht weiter entwickelt.
Daher auch die Bezeichnung " [ABD] " im Thementitel --> Abgebrochen.
paulpokemon
Mitglied
Beiträge: 58
Registriert: 25.04.2008 14:54

Beitrag von paulpokemon »

Danke ^-^
Hm nunja leider kann ich kein englisch um da zu fragen
Pokefan2
Mitglied
Beiträge: 201
Registriert: 12.10.2008 09:40
Kontaktdaten:

Re: Karma MOD für phpBB3.0.4?

Beitrag von Pokefan2 »

Falls es noch jemanden interessiret:
functions_karma.php

Code: Alles auswählen

<?php
/**
*
* @package karmamod
* @version $Id: functions_karma.php,v 1.17 2007/09/07 00:11:50 m157y Exp $
* @copyright (c) 2007 David Lawson, m157y, A_Jelly_Doughnut
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/

/*
SQL Changes from B1 to B2
ALTER TABLE `phpbb_karma` CHANGE `bbcode_uid` `bbcode_uid` VARCHAR( 8 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL

*/

// Table name
define('KARMA_TABLE', $table_prefix . 'karma');

class karmamod
{
// Config vars
var $version = '';
var $config = array();

// Auth vars
var $can_karma = false;
var $user_level = false;

// Optimization's vars
var $current_time = false;

/**
* Constructor
*/
function karmamod()
{
global $config, $user, $auth;

// Load language
$user->add_lang('mods/karma');

// Move configs to internal array, for less globals in functions
$this->version = $config['karma_version'];
$this->config['enabled'] = ($config['karma_enabled']) ? true : false;
$this->config['enabled_ucp'] = ($config['karma_enabled_ucp']) ? true : false;
$this->config['comments'] = ($config['karma_comments']) ? true : false;
$this->config['comments_reqd'] = ($config['karma_comments_reqd']) ? true : false;
$this->config['notify_email'] = ($config['email_enable'] && $config['karma_notify_email']) ? true : false;
$this->config['notify_pm'] = ($config['allow_privmsg'] && $config['karma_notify_pm']) ? true : false;
$this->config['notify_jabber'] = ($config['jab_enable'] && $config['karma_notify_jabber']) ? true : false;
$this->config['drafts'] = ($config['karma_drafts']) ? true : false;
$this->config['icons'] = ($config['karma_icons']) ? true : false;
$this->config['viewprofile'] = ($config['karma_viewprofile']) ? true : false;
$this->config['toplist'] = ($config['karma_toplist']) ? true : false;
$this->config['toplist_users'] = (int) ($user->data['is_registered']) ? $user->data['user_karma_toplist_users'] : $config['karma_toplist_users'];
$this->config['time'] = (float) $config['karma_time'];
$this->config['posts'] = (int) $config['karma_posts'];
$this->config['comments_per_page'] = (int) $config['karma_comments_per_page'];
$this->config['power'] = ($config['karma_power']) ? true : false;
$this->config['power_show'] = ($config['karma_power_show']) ? true : false;
$this->config['power_max'] = (int) ($config['karma_power_max'] < 1) ? 5 : $config['karma_power_max'];
$this->config['per_day'] = ($config['karma_per_day'] > 0) ? (int) $config['karma_per_day'] : false;

// Configure user settings
$this->user_level = ($auth->acl_get('a_')) ? 'admin' : (($user->data['is_registered']) ? 'user' : 'guest');
if ($this->user_level != 'guest')
{
$this->config['user_enabled'] = ($this->config['enabled_ucp'] && $user->data['user_karma_enable']) ? true : false;
$this->config['user_notify_email'] = ($this->config['notify_email'] && $user->data['user_karma_notify_email']) ? true : false;
$this->config['user_notify_pm'] = ($this->config['notify_pm'] && $user->data['user_karma_notify_pm']) ? true : false;
$this->config['user_notify_jabber'] = ($this->config['notify_jabber'] && $user->data['user_karma_notify_jabber']) ? true : false;
$this->config['toplist'] = ($this->config['toplist'] && $user->data['user_karma_toplist']) ? true : false;
$this->config['comments_per_page'] = (int) $user->data['user_karma_comments_per_page'];
}
else
{
$this->config['user_enabled'] = true;
$this->config['user_notify_email'] = false;
$this->config['user_notify_pm'] = false;
$this->config['user_notify_jabber'] = false;
}

$this->current_time = time();
}

/**
* Generate toplist if required ...
*/
function toplist()
{
if (!$this->config['enabled'] || !$this->config['toplist'])
{
return;
}

global $db, $phpbb_root_path, $phpEx, $template;

$karma_toplist = '';
$sql = 'SELECT user_id, username, user_colour, user_karma, user_karma_powered
FROM ' . USERS_TABLE . '
WHERE user_id <> ' . ANONYMOUS . '
AND ' . (($this->config['power']) ? 'user_karma_powered' : 'user_karma') . ' > 0
AND ' . $db->sql_in_set('user_type', array(USER_NORMAL, USER_FOUNDER)) . '
ORDER BY ' . (($this->config['power']) ? 'user_karma_powered' : 'user_karma') . ' DESC';
$result = $db->sql_query_limit($sql, $this->config['toplist_users']);

while ($row = $db->sql_fetchrow($result))
{
$user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] .'"' : '';
$karma_toplist .= (($karma_toplist != '') ? ', ' : '') . '<a' . $user_colour . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) . '">' . $row['username'] . '</a> (' . (($this->config['power']) ? $row['user_karma_powered'] : $row['user_karma']) . ')';
}
$db->sql_freeresult($result);

// Assign index specific vars
$template->assign_vars(array(
'S_KARMA_TOPLIST' => true,
'KARMA_TOPLIST' => $karma_toplist)
);
}

/**
* Checks can user karma or not?
*/
function check_can_karma($user_id = ANONYMOUS, $karma_time = 0, $foe = false, $friend = false)
{
if (!$this->config['enabled'])
{
return;
}

$this->can_karma = false;

if ($this->user_level != 'guest')
{
global $user;

if ($user->data['user_id'] != $user_id)
{
// It's disable not needed checks for admins
if ($this->user_level == 'admin')
{
$this->can_karma = true;
}
else
{
$this->can_karma = ($user->data['user_posts'] >= $this->config['posts'] && !$foe && !$friend) ? true : false;

if (($this->current_time - $karma_time) < ($this->config['time'] * 3600))
{
$this->can_karma = false;
return;
}

// Karmas per day checker
// if the user already cannot karma, then there is no point in an addtl query
if ($this->config['per_day'] && $this->can_karma && $this->can_karma)
{
global $db;

$sql = 'SELECT COUNT(*) as karmas_per_day
FROM ' . KARMA_TABLE . '
WHERE poster_id = ' . $user->data['user_id'] . '
AND karma_time > ' . (time() - 86400);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);

if ($row['karmas_per_day'] >= $this->config['per_day'])
{
$this->can_karma = false;
}
}
}
}
}
}

/**
* Adds karma's images to imageset editor
*/
function acp_styles_imageset(&$imageset_keys)
{
if (!$this->config['enabled'])
{
return;
}

$imageset_keys['ui'] = array_merge($imageset_keys['ui'], array('icon_karma_increase', 'icon_karma_decrease'));
}

/**
* Adds karma's input information and template to users management page at ACP
*/
function acp_users_data(&$data, $user_row)
{
if (!$this->config['enabled'])
{
return;
}

global $template, $config;

$data = array_merge($data, array(
'karma_enable' => request_var('karma_enable', (bool) $user_row['user_karma_enable']),
'karma_notify_email' => request_var('karma_notify_email', (bool) $user_row['user_karma_notify_email']),
'karma_notify_pm' => request_var('karma_notify_pm', (bool) $user_row['user_karma_notify_pm']),
'karma_notify_jabber' => request_var('karma_notify_jabber', (bool) $user_row['user_karma_notify_jabber']),
'karma_toplist' => request_var('karma_toplist', (bool) $user_row['user_karma_toplist']),
'karma_toplist_users' => request_var('karma_toplist_users', (int) $user_row['user_karma_toplist_users']),
'karma_comments_per_page' => request_var('karma_comments_per_page', (int) $user_row['user_karma_comments_per_page']),
));

$template->assign_vars(array(
'S_ENABLE' => $data['karma_enable'],
'S_NOTIFY_EMAIL' => $data['karma_notify_email'],
'S_NOTIFY_PM' => $data['karma_notify_pm'],
'S_NOTIFY_JABBER' => $data['karma_notify_jabber'],
'S_TOPLIST' => $data['karma_toplist'],
'TOPLIST_USERS' => $data['karma_toplist_users'],
'COMMENTS_PER_PAGE' => $data['karma_comments_per_page'],

'S_KARMA_ENABLE' => true)
);
}

/**
* Check errors at information on users management page at ACP
*/
function acp_users_error(&$error, $data)
{
if (!$this->config['enabled'])
{
return;
}

$error = array_merge($error, validate_data($data, array(
'karma_toplist_users' => array('num', false, 1),
'karma_comments_per_page' => array('num', false, 1, 999),
)));
}

/**
* Adds karma's information to sql of users management page at ACP
*/
function acp_users_sql(&$sql_ary, $data)
{
if (!$this->config['enabled'])
{
return;
}

$sql_ary = array(
'user_karma_enable' => $data['karma_enable'],
'user_karma_notify_email' => $data['karma_notify_email'],
'user_karma_notify_pm' => $data['karma_notify_pm'],
'user_karma_notify_jabber' => $data['karma_notify_jabber'],
'user_karma_toplist' => $data['karma_toplist'],
'user_karma_toplist_users' => $data['karma_toplist_users'],
'user_karma_comments_per_page' => $data['karma_comments_per_page'],
);
}

/**
* Adds karma's information to viewprofile page
*/
function memberlist_viewprofile($member, $foe = false, $friend = false)
{
if (!$this->config['enabled'] || !$member['user_karma_enable'])
{
return;
}

global $db, $user, $template, $phpbb_root_path, $phpEx;

// Select last karma time for this user
$sql = 'SELECT k.karma_time, k2.karma_time as karmaed
FROM ' . KARMA_TABLE . ' k
LEFT JOIN ' . KARMA_TABLE . ' k2
ON (k2.user_id = ' . $member['user_id'] . '
AND k2.poster_id = ' . $user->data['user_id'] . '
AND k2.forum_id = 0
AND k2.topic_id = 0
AND k2.post_id = 0)
WHERE k.user_id = ' . $member['user_id'] . '
AND k.poster_id = ' . $user->data['user_id'] . '
ORDER BY k.karma_time DESC';
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);

$this->check_can_karma($member['user_id'], $row['karma_time'], $foe, $friend);

$template->assign_vars(array(
'KARMA' => ($this->config['power']) ? $member['user_karma_powered'] : $member['user_karma'],
'U_KARMA_INCREASE' => ($this->can_karma && $member['user_karma_enable'] && !$row['karmaed']) ? append_sid("{$phpbb_root_path}karma.$phpEx", 'u=' . $member['user_id'] . '&mode=update&action=increase') : '',
'U_KARMA_DECREASE' => ($this->can_karma && $member['user_karma_enable'] && !$row['karmaed']) ? append_sid("{$phpbb_root_path}karma.$phpEx", 'u=' . $member['user_id'] . '&mode=update&action=decrease') : '',
'U_KARMA_COMMENTS' => ($this->config['viewprofile'] && $this->config['comments']) ? append_sid("{$phpbb_root_path}karma.$phpEx", 'mode=viewcomments&u=' . $member['user_id']) : '',
'S_KARMA' => true)
);
}

/**
* Add karma option to the dropdown in search
*/
function search_dropdown(&$sort_by_text)
{
if (!$this->config['enabled'])
{
return;
}

global $user;

$sort_by_text['k'] = $user->lang['KARMA'];
}

/**
* Add some SQL to the order by options in search
*/
function search_order_sql(&$sort_by_sql)
{
if (!$this->config['enabled'])
{
return;
}

global $show_results;

$sort_by_sql['k'] = (($show_results == 'posts') ? 'p.post_karma_search' : 't.topic_karma_search') . (($this->config['power']) ? '_powered' : '');
}

/**
* Update viewtopic's SQL-query for per user karma time work
* This may need to be worked on for later versions of the Karma MOD.
*/
function viewtopic_sql(&$sql)
{
if (!$this->config['enabled'])
{
return;
}

global $user;

$sql = str_replace('p.*', 'p.*, k.karma_time, k2.karma_time as karmaed', $sql);
$sql = str_replace('WHERE', 'LEFT JOIN ' . KARMA_TABLE . ' k ON (k.poster_id = ' . $user->data['user_id'] . ' AND k.user_id = p.poster_id) LEFT JOIN ' . KARMA_TABLE . ' k2 ON (k2.poster_id = ' . $user->data['user_id'] . ' AND k2.post_id = p.post_id AND k2.user_id = p.poster_id) WHERE', $sql);
}

/**
* Adds karmaed information to posts rowset
*/
function viewtopic_rowset(&$row, $karmaed = 0)
{
if (!$this->config['enabled'])
{
return;
}

$row['karmaed'] = ($karmaed) ? true : false;
}

/**
* Adds karma's information to user's cache on viewtopic page
*/
function viewtopic_usercache(&$user_cache, $poster_id, $row)
{
if ($poster_id == ANONYMOUS || !$this->config['enabled'])
{
$karma_cache = array(
'karma' => 0,
'karma_can' => false,
'karma_enabled' => false,
);
}
else
{
$this->check_can_karma($poster_id, $row['karma_time'], $row['foe'], $row['friend']);

$karma_cache = array(
'karma' => ($this->config['power']) ? $row['user_karma_powered'] : $row['user_karma'],
'karma_can' => ($this->can_karma) ? true : false,
'karma_enabled' => ($row['user_karma_enable']) ? true : false,
);
}
$user_cache = array_merge($user_cache, $karma_cache);
}

/**
* Adds karma's information to post on viewtopic page
*/
function viewtopic_postrow(&$postrow, $user_cache, $poster_id, $forum_id, $topic_id, $post_id, $karmaed = false)
{
global $phpbb_root_path, $phpEx;

$postrow = array_merge($postrow, array(
'KARMA' => $user_cache['karma'],
'U_KARMA_INCREASE' => ($user_cache['karma_can'] && $user_cache['karma_enabled'] && !$karmaed) ? append_sid("{$phpbb_root_path}karma.$phpEx", 'u=' . $poster_id . '&f=' . $forum_id . '&t=' . $topic_id . '&p=' . $post_id . '&mode=update&action=increase') : '',
'U_KARMA_DECREASE' => ($user_cache['karma_can'] && $user_cache['karma_enabled'] && !$karmaed) ? append_sid("{$phpbb_root_path}karma.$phpEx", 'u=' . $poster_id . '&f=' . $forum_id . '&t=' . $topic_id . '&p=' . $post_id . '&mode=update&action=decrease') : '',
'U_KARMA_COMMENTS' => ($user_cache['karma_enabled'] && $this->config['viewprofile'] && $this->config['comments']) ? append_sid("{$phpbb_root_path}karma.$phpEx", 'mode=viewcomments&u=' . $poster_id) : '',
'S_KARMA_ENABLED' => $this->config['enabled'])
);
}

/**
* Below placed functions which used by karma.php
*
*
* Submit karma to db
*/
function submit_karma($data)
{
global $db, $user;

$current_time = time();

// Update poster's karma
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_karma = user_karma ' . (($data['action'] == 'decrease') ? '-' : '+') . ' 1, user_karma_powered = user_karma_powered ' . (($data['action'] == 'decrease') ? '- ' : '+ ') . $data['karma_power'] . '
WHERE user_id = ' . $data['user_id'];
$db->sql_query($sql);

// Insert data to DB
$sql_ary = array(
'forum_id' => $data['forum_id'],
'topic_id' => $data['topic_id'],
'post_id' => $data['post_id'],
'user_id' => $data['user_id'],
'poster_id' => (int) $user->data['user_id'],
'icon_id' => $data['icon_id'],
'poster_ip' => $user->ip,
'karma_time' => $current_time,
// TODO: approved status for comments
'karma_approved' => 1,
'enable_bbcode' => $data['enable_bbcode'],
'enable_smilies' => $data['enable_smilies'],
'enable_magic_url' => $data['enable_urls'],
'comment_text' => $data['comment'],
'comment_checksum' => $data['comment_md5'],
'bbcode_bitfield' => $data['bbcode_bitfield'],
'bbcode_uid' => $data['bbcode_uid'],
'karma_action' => ($data['action'] == 'decrease') ? '-' : '+',
'karma_power' => $data['karma_power'],
);

$sql = 'INSERT INTO ' . KARMA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);

// now we update the posts & topics tables with a bit of information
$sql = 'UPDATE ' . POSTS_TABLE . '
SET post_karma = post_karma ' . (($data['action'] == 'decrease') ? '-' : '+') . ' 1, post_karma_powered = post_karma_powered ' . ($data['action'] == 'decrease' ? '- ' : '+ ') . (int) $data['karma_power'] . ', post_karma_count = post_karma_count + 1, post_karma_search = (post_karma / post_karma_count), post_karma_search_powered = (post_karma_powered / post_karma_count)
WHERE post_id = ' . (int) $data['post_id'];
$db->sql_query($sql);

$sql = 'UPDATE ' . TOPICS_TABLE . '
SET topic_karma = topic_karma ' . (($data['action'] == 'decrease') ? '-' : '+') . ' 1, topic_karma_powered = topic_karma_powered ' . ($data['action'] == 'decrease' ? '- ' : '+ ') . (int) $data['karma_power'] . ', topic_karma_count = topic_karma_count + 1, topic_karma_search = ((topic_karma / topic_karma_count) / (topic_replies + 1)), topic_karma_search_powered = ((topic_karma_powered / topic_karma_count) / (topic_replies + 1))
WHERE topic_id = ' . (int) $data['topic_id'];
$db->sql_query($sql);

// Send Notifications
$this->user_notification($data);

return;
}

/**
* Notify users about karma's changes (via PM/email/jabber)
*/
function user_notification($data)
{
$forum_id = $data['forum_id'];
$topic_id = $data['topic_id'];
$post_id = $data['post_id'];
$user_id = $data['user_id'];

// Select template for messenger, subject and message
if ($data['action'] == 'increase')
{
$subject = 'KARMA_NOTIFY_INCREASE_SUBJECT';
$message = 'KARMA_NOTIFY_INCREASE_MESSAGE';
$notify_tpl = 'karma_notify_increase';
}
else
{
$subject = 'KARMA_NOTIFY_DECREASE_SUBJECT';
$message = 'KARMA_NOTIFY_DECREASE_MESSAGE';
$notify_tpl = 'karma_notify_decrease';
}
if ($this->config['power_show'])
{
$message .= '_POWERED';
$notify_tpl .= '_powered';
}

if ($this->config['user_notify_pm'])
{
global $config, $user, $phpbb_root_path, $phpEx;

$subject = $user->lang[$subject];
$message = sprintf($user->lang[$message], $user->data['username'], $data['karma_power']);
$message .= (!empty($data['comment'])) ? "\r\n" . sprintf($user->lang['KARMA_NOTIFY_MESSAGE_COMMENTS'], $user->data['username']) . "\r\n\r\n" . $data['comment'] : '';
$message .= "\r\n\r\n" . $this->generate_backlink($forum_id, $topic_id, $post_id, $user_id);

include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);

$message_parser = new parse_message();

$message = utf8_normalize_nfc($message);
$options = '';
generate_text_for_storage($message, $data['bbcode_uid'], $data['bbcode_bitfield'], $options, true, true, true);

$icon_id = $data['icon_id'];

// Always attach signature status
$enable_sig = (!$config['allow_sig'] || !$config['allow_sig_pm']) ? false : (($user->optionget('attachsig')) ? true : false);

// Store message, sync counters
$pm_data = array(
'from_user_id' => $user->data['user_id'],
'from_user_ip' => $user->data['user_ip'],
'from_username' => $user->data['username'],
'icon_id' => (int) $icon_id,
'enable_sig' => (bool) $enable_sig,
'enable_bbcode' => $data['enable_bbcode'],
'enable_smilies' => $data['enable_smilies'],
'enable_urls' => $data['enable_urls'],
'bbcode_bitfield' => $data['bbcode_bitfield'],
'bbcode_uid' => $data['bbcode_uid'],
'message' => $message,
'address_list' => array ('u' => array($data['user_id'] => 'to'))
);
unset($message_parser);

submit_pm('post', $subject, $pm_data);
}

if ($this->config['user_notify_email'] || $this->config['user_notify_jabber'])
{
if ($this->config['user_notify_email'] && $this->config['user_notify_jabber'])
{
$method = NOTIFY_BOTH;
}
else if ($this->config['user_notify_email'])
{
$method = NOTIFY_EMAIL;
}
else if ($this->config['user_notify_jabber'])
{
$method = NOTIFY_IM;
}
else
{
return;
}

$comment = '';
if ($this->config['comments'] && $data['comment'])
{
$comment = $data['comment'];
// make list items visible as such
if ($dataa['bbcode_uid'])
{
$comment = str_replace('[*:' . $data['bbcode_uid'] . ']', '&sdot;&nbsp;', $comment);
// no BBCode in comment
strip_bbcode($comment, $data['bbcode_uid']);
}
$comment = "\r\n" . $user->lang['KARMA_NOTIFY_MESSAGE_COMMENTS'] . "\r\n" . $comment . "\r\n";
}

// Now, we are able to really send out notifications
global $db, $phpbb_root_path, $phpEx;

include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx);
$messenger = new messenger();

$messenger->template($notify_tpl, $user->data['user_lang']);

$messenger->to($user->data['user_email'], $user->data['username']);
$messenger->im($user->data['user_jabber'], $user->data['username']);

$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($user->data['username']),
'AUTHOR_NAME' => htmlspecialchars_decode($data['username']),
'POWER' => $data['karma_power'],
'BACKLINK' => $this->generate_backlink($forum_id, $topic_id, $post_id, $user_id),

'COMMENT' => $comment,
));

$messenger->send($method);

$messenger->save_queue();
}
}

/**
* Thus function generate backlinks for karma changes notifications
*/
function generate_backlink($forum_id = 0, $topic_id = 0, $post_id = 0, $user_id = 0)
{
global $user, $phpEx;

$viewtopic = false;

if ($post_id)
{
$message = $user->lang['KARMA_NOTIFY_BACKLINK_POST'];
$viewtopic = true;
}
else if ($topic_id)
{
$message = $user->lang['KARMA_NOTIFY_BACKLINK_TOPIC'];
$viewtopic = true;
}
else
{
$message = $user->lang['KARMA_NOTIFY_BACKLINK_PROFILE'];
}

if ($viewtopic)
{
$url = generate_board_url() . "/viewtopic.$phpEx?" . (($forum_id) ? "f=$forum_id&" : '') . (($topic_id) ? "t=$topic_id&" : '') . (($post_id) ? "p=$post_id#p$post_id" : '');
}
else
{
$url = generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u=$user_id";
}

$backlink = $message . $url;

return $backlink;
}

/**
* Prepare profile data
* Used on viewcomments page
* Copied from memberlist.php
*/
function show_profile($data)
{
global $config, $auth, $template, $user, $phpEx, $phpbb_root_path;

$username = $data['username'];
$user_id = $data['user_id'];

$rank_title = $rank_img = $rank_img_src = '';
get_user_rank($data['user_rank'], $data['user_posts'], $rank_title, $rank_img, $rank_img_src);

if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_email'))
{
$email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $data['user_email']);
}
else
{
$email = '';
}

if ($config['load_onlinetrack'])
{
$update_time = $config['load_online_time'] * 60;
$online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline'])) || $auth->acl_get('u_viewonline'))) ? true : false;
}
else
{
$online = false;
}

if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline'))
{
$last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit'];
}
else
{
$last_visit = '';
}

$age = '';

if ($data['user_birthday'])
{
list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday']));

if ($bday_year)
{
$now = getdate(time() + $user->timezone + $user->dst - date('Z'));

$diff = $now['mon'] - $bday_month;
if ($diff == 0)
{
$diff = ($now['mday'] - $bday_day < 0) ? 1 : 0;
}
else
{
$diff = ($diff < 0) ? 1 : 0;
}

$age = (int) ($now['year'] - $bday_year - $diff);
}
}

// Dump it out to the template
return array(
'AGE' => $age,
'RANK_TITLE' => $rank_title,
'JOINED' => $user->format_date($data['user_regdate']),
'VISITED' => (empty($last_visit)) ? ' - ' : $user->format_date($last_visit),
'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0,
'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0,

'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']),
'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']),
'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']),
'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']),

'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')),
'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false,
'RANK_IMG' => $rank_img,
'RANK_IMG_SRC' => $rank_img_src,
'ICQ_STATUS_IMG' => (!empty($data['user_icq'])) ? '<img src="http://web.icq.com/whitepages/online?icq=' . $data['user_icq'] . '&img=5" width="18" height="18" />' : '',
'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false,

'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '',
'U_NOTES' => $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '',
'U_WARN' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '',
'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '',
'U_EMAIL' => $email,
'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '',
'U_ICQ' => ($data['user_icq']) ? 'http://www.icq.com/people/webmsg.php?to=' . $data['user_icq'] : '',
'U_AIM' => ($data['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=aim&u=' . $user_id) : '',
'U_YIM' => ($data['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $data['user_yim'] . '&.src=pg' : '',
'U_MSN' => ($data['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=msnm&u=' . $user_id) : '',
'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '',
'LOCATION' => ($data['user_from']) ? $data['user_from'] : '',

'USER_ICQ' => $data['user_icq'],
'USER_AIM' => $data['user_aim'],
'USER_YIM' => $data['user_yim'],
'USER_MSN' => $data['user_msnm'],
'USER_JABBER' => $data['user_jabber'],
'USER_JABBER_IMG' => ($data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '',

'L_VIEWING_PROFILE' => sprintf($user->lang['VIEWING_PROFILE'], $username),
);
}
}

$karmamod = NULL;

?>

Quelle: http://forum.pokefans.net/viewtopic.php?f=49&t=26314
Ich baue ein Forum für Mods, BBCodes etc. auf!
Eben alles über phpbb3.
Wer Interesse hat -> PN Dieses Projekt ist neu erwacht!
Antworten

Zurück zu „[3.0.x] Mod Support“