22 พฤษภาคม 2555, 15:25:57
ยินดีต้อนรับผู้เยี่ยมชม
  • noavata
  • ยินดีต้อนรับคุณ, ผู้เยี่ยมชม กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน
    เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น
Page Rank

ทำเว็บไซต์ | แต่งบอร์ด | ออกแบบ | SMF | Joomla | Drupal | WordPress | JQuery | CMS | ECommerce | Tel. +668-08577477

ส่งหัวข้อนี้พิมพ์ หน้า: 1 
icon message ผู้เขียน หัวข้อ: Advanced Reputation System ระบบเกียติยศใน SMF  (อ่าน 1825 ครั้ง)
0 สมาชิก และ 1 ผู้เยี่ยมชม กำลังดูหัวข้อนี้
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general เมื่อ: 8 มิถุนายน 2553, 19:57:12
  • ชื่อ: Advanced Reputation System
  • ผู้เขียน: Ha²
  • นำเสนอโดย: DexMoreGroup
  • ประเภท: Socialization
  • รองรับ: SMF 1.1.xx, 2.0.xx
  • ปรับปรุงล่าสุด: 20 มีนาคม 2553
  • ต้นฉบับ: Advanced Reputation System

รายละเอียด
      ระบบเกียรติยศคล้ายๆ กับระบบขอบคุณที่มีใช้กันอยู่ทั่วไป แต่ระบบนี้ใช้ระบบกามาร์ของ SMF สำหรับแสดงความคิดเห็น เห็นด้วย หรือไม่เห็นด้วยโดยมีความสามารถพิเศษดังนี้..
  • เพิ่มจำนวนทันทีเมื่อมีการให้คะแนนเสียง
  • มี PopUp ให้แสดงความคิดเห็น
  • สมาชิกสามารถดูคะแนนนิยมได้ในข้อมูลส่วนตัว
  • ผู้ดูแลหรือกลุ่มสมาชิกที่ได้รับอนุญาตสามารถลบคะแนนเสียงได้
  • สามารถให้คะแนนเสียงอัตโนมัติแก่สมาชิกที่เริ่มหัวข้อใหม่, ตอบกระทู้, วันเกิด, สมัครสมาชิก
  • สามารถนำไปแสดงผลร่วมกับบล๊อกของ SimplePortal ได้

ตัวอย่าง
   



แก้ไขไฟล์:

file $boarddir/index.php

ค้นหา -->>
โค๊ด: [Select]
'reporttm' => array('SendTopic.php', 'ReportToModerator'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'reputation' => array('Karma.php', 'SendKarma'),

file $themedir/Display.template.php

ค้นหา -->>
โค๊ด: [Select]
<a name="top"></a>

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
<span id="reputation_menu" style="visibility: hidden; display: none;">
<table class="bordercolor" cellpadding="4" cellspacing="1" style="width: 100%;">
<tr class="titlebg">
<td height="22">', $txt['karma_title'], '</td>
</tr>
<tr class="catbg">
<td height="22">', $txt['karma_add_to'], ': <span id="reputation_name">&nbsp;</span></td>
</tr>
<tr class="windowbg2">
<td>
<fieldset>
<legend>', $txt['karma_your_opinion'], '</legend>
<form id="reputation_form" name="reputation_form" action="', $scripturl, '?action=modifykarma" method="post" accept-charset="', $context['character_set'], '" class="reputation_form">
<input type="radio" name="type" value="agree"', !$context['can_pos_rep'] ? ' disabled="disabled"' : ' checked="checked"', ' /> ', $txt['karma_agree'], '
<input type="radio" name="type" value="disagree"', !$context['can_neg_rep'] ? ' disabled="disabled"' : !$context['can_pos_rep'] ? ' checked="checked"' : '', ' /> ', $txt['karma_disagree'], '
<span id="reputation_fields">&nbsp;</span>
<br />
', $txt['comment'], ': <input type="text" name="reputation_comment" /><br />
<br />
<input type="submit" value="', $txt['submit'], '" />
<input type="hidden" name="topic" value="', $context['current_topic'], '.', $context['start'], '" />
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>
</fieldset>
</td>
</tr>
</table>
</span>

ค้นห -->>
โค๊ด: [Select]
// Is karma display enabled?  Total or +/-?
if ($modSettings['karmaMode'] == '1')
echo '
<br />
', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '
<br />
', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '<br />';

// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';

แก้เป็น -->>
โค๊ด: [Select]
// Is karma display enabled?
if ($modSettings['karmaMode'] != '0'){
echo '
<br />
', $txt['karma_power'], ': ', $message['member']['karma']['power'], '<br />
<span class="repbars">
';

foreach($message['member']['karma']['bars'] as $karma_bar)
echo '<img src="', $settings['images_url'], '/karma', $karma_bar['type'], '.gif" title="', $message['member']['name'], ' ', $karma_bar['desc'], '" alt="', $message['member']['name'], ' ', $karma_bar['desc'], '" />';

echo '
</span>
<br />';
}

ค้นหา -->>
โค๊ด: [Select]
// Since we know this person isn't a guest, you *can* message them.
if ($context['can_send_pm'])
echo '
<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" border="0" />' : $message['member']['online']['label'], '</a>';

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Is this user allowed to modify this member's karma?
if (($context['can_pos_rep'] || $context['can_neg_rep']) && $message['can_send_karma'] && ($context['user']['id'] != $message['member']['id']))
echo '
<span style="visibility: hidden; display: none;" id="reputation_form_', $message['id'], '">
<input type="hidden" name="uid" value="', $message['member']['id'], '" />
<input type="hidden" name="m" value="', $message['id'], '" />
</span>
<a id="repicon" onclick="reputationForm(\'reputation_form_', $message['id'], '\', \'', $message['member']['name'], '\', this, event); return false;" href="', $scripturl, '?action=reputation;uid=', $message['member']['id'], ';m=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';sesc=', $context['session_id'], '"><img src="', $settings['images_url'], '/karma.gif" alt="', $txt['add_karma'], '" title="', $txt['add_karma'], '" /></a>';

file $themedir/PersonalMessage.template.php

ค้นหา -->>
โค๊ด: [Select]
// Is karma display enabled? Total or +/-?
if ($modSettings['karmaMode'] == '1')
echo '
<br />
', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '
<br />
', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '<br />';

// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a> <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';sesc=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a><br />';

แก้เป็น -->>
โค๊ด: [Select]
// Karma removed by the Advanced Reputation System - who ever though karma in PMs was a good decision?

file $themedir/Profile.template.php

ค้นหา -->>
โค๊ด: [Select]
// If karma enabled show the members karma.
if ($modSettings['karmaMode'] == '1')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '
</td>
</tr>';
elseif ($modSettings['karmaMode'] == '2')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '
</td>
</tr>';

แก้เป็น -->>
โค๊ด: [Select]
// If karma enabled show the members karma.
if ($modSettings['karmaMode'] != '0')
echo '
<tr>
<td>
<b>', $modSettings['karmaLabel'], ' </b>
</td><td>
', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '
</td>
</tr>';

ค้นหา -->>
โค๊ด: [Select]
// If karma is enabled let the admin edit it...

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Can you disable your own karma display?
if (!empty($modSettings['karmaMode']) && $context['allow_disable_karma'])
{
echo '
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr><tr>
<td valign="top"><b>', $txt['user_disable_karma'], '</b></td>
<td><input type="hidden" name="karma_disabled" value="0" /><input type="checkbox" name="karma_disabled"', $context['member']['karma']['disabled'] ? ' checked="checked"' : '', ' value="1" class="check" /></td>
</tr>';
}

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Shows recent reputation actions, and allows moderators to moderate them.
function template_reputation()
{
global $context, $settings, $options, $scripturl, $modSettings, $txt, $ID_MEMBER;

// If they can delete karma actions, start the form
if($context['can_delete_karma'] && !empty($context['member']['karma_actions']))
echo '
<form action="', $scripturl, '?action=profile;u=', $ID_MEMBER, ';sa=reputation" method="post" accept-charset="', $context['character_set'], '">
<input type="hidden" name="uid" value="', $ID_MEMBER, '" />
<input type="hidden" name="sc" value="', $context['session_id'], '" />';

echo '
<table width="80%" border="0" cellpadding="4" cellspacing="1" align="center" class="bordercolor">
<tr class="titlebg">
<td colspan="', $context['can_delete_karma'] ? 7 : 6, '">
', $txt['karma_latest_title'], '
</td>
</tr>';

if(empty($context['member']['karma_actions']))
echo '
<tr class="windowbg">
<td colspan="', $context['can_delete_karma'] ? 7 : 6, '">
', $txt['no_reputation_actions'], '
</td>
</tr>';
else {
echo '
<tr class="catbg2">
<td width="1%">
&nbsp;
</td>
<td width="', $context['can_delete_karma'] ? '29' : '30', '%">
', $txt[118], '
</td>
<td width="15%">
', $txt[317], '
</td>
<td width="30%">
', $txt['comment'], '
</td>
<td width="12%">
', $txt[324], '
</td>
<td width="12%">
', $txt[318], '
</td>', $context['can_delete_karma'] ? '
<td width="1%">
<input type="checkbox" onclick="invertAll(this, this.form);" class="check" />
</td>' : '', '
</tr>';
foreach($context['member']['karma_actions'] as $karma)
echo '
<tr class="windowbg">
<td align="center">
<img src="', $settings['images_url'], '/', $karma['action_type'], '_basic.gif" />
</td>
<td>
<a href="', $scripturl, '?topic=', $karma['topic_href'], '">', $karma['topic_title'], '</a>
</td>
<td>
', $karma['time'], '
</td>
<td>
', $karma['comment'], '
</td>
<td>
', $karma['target'], '
</td>
<td>
', $karma['executor'], '
</td>', $context['can_delete_karma'] ? '
<td align="center">
<input type="checkbox" name="deleteBoxes[]" value="' . $karma['delete_value'] . '" class="check" />
</td>' : '', '
</tr>';

echo '
<tr class="catbg2">
<td colspan="', $context['can_delete_karma'] ? 7 : 6, '">
', $txt[139], ': ', $context['page_index'], '
</td>
</tr>';
}
// And close off the table.
echo '
</table>';

// If they can delete karma actions, end the old
if($context['can_delete_karma'] && !empty($context['member']['karma_actions']))
echo '
<br />
<div width="100%" align="center">
<input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['quickmod_confirm'], '\')) return false;" /></span>
</div>
</form>';
}

file $themedir/Stats.template.php

ค้นหา -->>
โค๊ด: [Select]
<tr>
<td class="catbg" colspan="2" width="50%"><b>', $txt['smf_stats_11'], '</b></td>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
';

if(!empty($modSettings['karmaMode'])){
echo '
<tr>
<td class="catbg" colspan="2" width="50%"><b>', $txt['smf_stats_17'], '</b></td>
<td class="catbg" colspan="2" width="50%"><b>', $txt['smf_stats_18'], '</b></td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
if(!empty($context['reputation_best']))
foreach ($context['reputation_best'] as $member)
echo '
<tr>
<td width="60%" valign="top">', $member['link'], '</td>
<td width="20%" align="left" valign="top"><span class="repbars">', $member['reputation_bars'], '</span></td>
<td width="20%" align="right" valign="top" nowrap="nowrap">', $member['amount'], '</td>
</tr>';
echo '
</table>
</td>
<td class="windowbg" width="20" valign="middle" align="center" nowrap="nowrap"><img src="', $settings['images_url'], '/stats_posters.gif" width="20" height="20" alt="" /></td>
<td class="windowbg2" width="50%" valign="top">
<table border="0" cellpadding="1" cellspacing="0" width="100%">';
if(!empty($context['reputation_worst']))
foreach ($context['reputation_worst'] as $member)
echo '
<tr>
<td width="60%" valign="top">', $member['link'], '</td>
<td width="20%" align="left" valign="top"><span class="repbars">', $member['reputation_bars'], '</span></td>
<td width="20%" align="right" valign="top" nowrap="nowrap">', $member['amount'], '</td>
</tr>';
echo '
</table>
</td>
</tr>';
}

echo '

file $themedir/script.js

เพิ่มไว้หลังสุด -->>
โค๊ด: [Select]
var disappeardelay = 30 * 1000; // karma box hide display time, in milliseconds
var vertical_offset = "0px"; // vertical offset of karma box from image
var horizontal_offset = "-3px"; // horizontal offset of karma box from image

function getposOffset(what, offsettype){
var totaloffset = (offsettype=="left") ? what.offsetLeft : what.offsetTop;
var parentEl = what.offsetParent;
while (parentEl!=null){
totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
parentEl = parentEl.offsetParent;
}
return totaloffset;
}

function showhiderep(obj, e){
rep_box.style.left = rep_box.style.top = -500;
rep_box.widthobj = rep_box.style;
rep_box.widthobj.width = '300px';
if (obj.visibility == "visible"){
obj.visibility = "hidden";
obj.display = "none";
} else {
obj.visibility = "visible";
obj.display = "block";
}
}

function reputationForm(rep_contents, member_name, obj, e){
if(window.event)
event.cancelBubble = true;
else if(e.stopPropagation)
e.stopPropagation();
clearhidebox();
rep_box = document.getElementById("reputation_menu");
rep_fields = document.getElementById("reputation_fields");
rep_name = document.getElementById("reputation_name");
setInnerHTML(rep_fields, getInnerHTML(document.getElementById(rep_contents)));
setInnerHTML(rep_name, member_name);

showhiderep(rep_box.style, e);
rep_box.x = getposOffset(obj, "left");
rep_box.y = getposOffset(obj, "top");
rep_box.style.left = rep_box.x + "px";
rep_box.style.top = rep_box.y + obj.offsetHeight + "px";

delayhidebox();
}

function hidebox(e){
if(typeof rep_box != "undefined")
rep_box.style.visibility = "hidden";
}

function delayhidebox(){
delayhide = setTimeout("hidebox()", disappeardelay);
}

function clearhidebox(){
if(typeof delayhide != "undefined")
clearTimeout(delayhide);
}

file $themedir/style.css

เพิ่มไว้หลังสุด -->>
โค๊ด: [Select]
.repbars img
{
padding: 0 1px 0 0;
}

#reputation_menu{
position: absolute;
border: 1px solid black;
z-index: 100;
}

file $sourcedir/Admin.php

ค้นหา -->>
โค๊ด: [Select]
// Clear out the karma actions.
db_query("
DELETE FROM {$db_prefix}log_karma", __FILE__, __LINE__);

แก้เป็น -->>
โค๊ด: [Select]
// Advanced Reputation System - Never clear out karma logs!
/*
// Clear out the karma actions.
db_query("
DELETE FROM {$db_prefix}log_karma", __FILE__, __LINE__);
*/

file $sourcedir/Display.php

ค้นหา -->>
โค๊ด: [Select]
'can_see_ip' => allowedTo('moderate_forum') || ($message['ID_MEMBER'] == $ID_MEMBER && !empty($ID_MEMBER)),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'can_send_karma' => empty($message['is_repped']) && ($ID_MEMBER != $message['ID_MEMBER']),

ค้นหา -->>
โค๊ด: [Select]
$messages_request = db_query("
SELECT
ID_MSG, icon, subject, posterTime, posterIP, ID_MEMBER, modifiedTime, modifiedName, body,
smileysEnabled, posterName, posterEmail,
ID_MSG_MODIFIED < $topicinfo[new_from] AS isRead
FROM {$db_prefix}messages
WHERE ID_MSG IN (" . implode(',', $messages) . ")
ORDER BY ID_MSG" . (empty($options['view_newest_first']) ? '' : ' DESC'), __FILE__, __LINE__);

แก้เป็น -->>
โค๊ด: [Select]
$messages_request = db_query("
SELECT
m.ID_MSG, m.icon, m.subject, m.posterTime, m.posterIP, m.ID_MEMBER, m.modifiedTime, m.modifiedName, m.body,
m.smileysEnabled, m.posterName, m.posterEmail,
m.ID_MSG_MODIFIED < $topicinfo[new_from] AS isRead, k.message AS is_repped
FROM {$db_prefix}messages AS m
LEFT JOIN {$db_prefix}log_karma AS k ON (k.message = m.ID_MSG AND k.ID_EXECUTOR = {$ID_MEMBER})
WHERE m.ID_MSG IN (" . implode(',', $messages) . ")
ORDER BY m.ID_MSG" . (empty($options['view_newest_first']) ? '' : ' DESC'), __FILE__, __LINE__);

ค้นหา -->>
โค๊ด: [Select]
$context['can_reply'] &= empty($topicinfo['locked']) || allowedTo('moderate_board');

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
$context['can_pos_rep'] = allowedTo('positive_karma');
$context['can_neg_rep'] = allowedTo('negative_karma');

ลิงค์หัวข้อ: http://dexmore.com/topic/1872
Windows XP    Firefox 3.6.3   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 1 เมื่อ: 9 มิถุนายน 2553, 00:12:41
file $sourcedir/Karma.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Modify a user's karma, only better than the old one!
function ModifyKarma()
{
global $modSettings, $txt, $user_info, $ID_MEMBER, $db_prefix;

// A fix for templates that don't get edited correctly, and still show the old links.
if(isset($_GET['sa']) && ($_GET['sa'] == 'applaud' || $_GET['sa'] == 'smite'))
redirectexit('action=reputation;uid=' . $_GET['uid'] . ';m=' . $_GET['m'] . ';topic=' . $_GET['topic'] . ';sesc=' . $_GET[$context['session_id']]);

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

// These _must_ be numbers, no matter what.
$uid = (int) $_POST['uid'];
$message_id = (int) $_POST['m'];
$topic_id = (int) $_POST['topic'];

// If you're a guest or can't do this, blow you off...
is_not_guest();
isAllowedTo('karma_edit');

checkSession('request');

// If you don't have enough posts, tough luck.
// !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
if ($user_info['posts'] < $modSettings['karmaMinPosts'])
fatal_lang_error('smf60', true, array($modSettings['karmaMinPosts']));

// And you can't modify your own, punk! (use the profile if you need to, admins!)
if (empty($uid) || $uid == $ID_MEMBER)
fatal_lang_error('smf61', false);

// Find their (super)power (and their secret identity)! Can't go into negatives...
$points = $user_info['karmaGood'] - $user_info['karmaBad'];
$power = ($points - ($points % $modSettings['karmaBarPower'])) / $modSettings['karmaBarPower'];
$power = (int) (($power > 0) ? $power : 0);

// !!! Should use a modSetting for 300
$comment = (strlen($_POST['reputation_comment']) > 300) ? substr($_POST['reputation_comment'], 0, 300) : $_POST['reputation_comment'];

// I fart in your general direction!
if (strtolower($comment) == 'your mother was a hamster and your father smelt of elderberries!')
fatal_error('...and Saint Attila raised the hand grenade up on high, saying, "O Lord, bless this Thy hand grenade that with it Thou mayest blow Thine enemies to tiny bits, in Thy mercy." And the Lord did grin and the people did feast upon the lambs and sloths and carp and anchovies and orangutans and breakfast cereals, and fruit bats and large chu... *ahem* And the Lord spake, saying, "First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who being naughty in my sight, shall snuff it." Amen.', false);
else
$comment = mysql_real_escape_string($comment);

//Find the time 24 hours ago... but wait... what if karmaWaitTime is greater than 24?! Bad var name, but who gives a hoot, if it works?
$yesterday = time() - 86400;
$longtimeago = time() - (60 * 60 * ($modSettings['karmaWaitTime']));
$hoursAgo = ($modSettings['karmaWaitTime'] < 24) ? $yesterday : $longtimeago;

// Applauding or smiting? Don't try to do a cheap javascript injection on me...
switch ($_POST['type']) {
case 'agree':
if(!allowedTo('positive_karma'))
fatal_lang_error('karma_cant_agree', false);
$karma_which = 'karmaGood';
break;
case 'disagree':
if(!allowedTo('negative_karma'))
fatal_lang_error('karma_cant_disagree', false);
$karma_which = 'karmaBad';
break;
default:
// Should never get here
fatal_lang_error('karma_choose_action', false);
}

// Going in order of permissions... it only gets added if it passes all of the tests!

// Used up all of their $modSettings['karmaMaxPerDay'] ?
if (!empty($modSettings['karmaMaxPerDay']) && ($modSettings['karmaMaxPerDay'] > 0))
{
// Find out if this user has done this in the past 24 hours.
$request = db_query("
SELECT logTime
FROM {$db_prefix}log_karma
WHERE ID_EXECUTOR = {$ID_MEMBER}
AND logTime >= {$hoursAgo}", __FILE__, __LINE__);
if (mysql_num_rows($request) >= $modSettings['karmaMaxPerDay']){ // but why would they be over?
mysql_free_result($request);
fatal_lang_error('karma_maxed_out', false, array($modSettings['karmaMaxPerDay']));
}

// They're good on this one :) Continue on to the next test!
mysql_free_result($request);
}

// Haven't waited long enough?
if (!empty($modSettings['karmaWaitTime']) && (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum')) && $modSettings['karmaWaitTime'] > 0)
{
// Find out if this user has done this in the past $longenough.
$request = db_query("
SELECT logTime
FROM {$db_prefix}log_karma
WHERE ID_EXECUTOR = {$ID_MEMBER}
AND logTime >= {$longtimeago}
LIMIT 1", __FILE__, __LINE__);
if (mysql_num_rows($request) > 0){
// Give them approximate minutes until they can, to be nice ;)
list ($logTime) = mysql_fetch_row($request);
$logTime_wait = ($logTime + (60 * 60 * $modSettings['karmaWaitTime'])) - time(); // seconds
$logTime_wait = ($logTime_wait - ($logTime_wait % 60)) / 60; // minutes
mysql_free_result($request);
fatal_lang_error('karma_please_wait', false, array($modSettings['karmaWaitTime'], $logTime_wait));
}

// They're good on this one :) Continue on to the next test!
mysql_free_result($request);
}

// Need to spread it around a bit? No, not the flu, silly!
if (!empty($modSettings['karmaSpreadAround']) && ($modSettings['karmaSpreadAround'] > 0))
{
// Grab the latest karmaSpreadAround actions - if the target is in there, throw an error!
$request = db_query("
SELECT ID_TARGET
FROM {$db_prefix}log_karma
WHERE ID_EXECUTOR = {$ID_MEMBER}
ORDER BY logTime DESC
LIMIT " . $modSettings['karmaSpreadAround'], __FILE__, __LINE__);
if (mysql_num_rows($request) > 0)
while($row = mysql_fetch_assoc($request))
if($row['ID_TARGET'] == $uid)
fatal_lang_error('karma_spread_around', false);

// They're good on this one :) Continue on to the next test!
mysql_free_result($request);
}

// One last test - have they already sent rep to this particular post?
$request = db_query("
SELECT logTime
FROM {$db_prefix}log_karma
WHERE ID_EXECUTOR = {$ID_MEMBER}
AND message = {$message_id}
LIMIT 1", __FILE__, __LINE__);

if(mysql_num_rows($request) != 0)
fatal_lang_error('karma_sent_twice', false);

mysql_free_result($request);

// Finally! Now do an update

$request = db_query("
UPDATE {$db_prefix}members
SET {$karma_which} = {$karma_which} + {$power}
WHERE ID_MEMBER = {$uid}", __FILE__, __LINE__);

if(!$request)
fatal_lang_error('karma_didnt_update', false);

$action_type = ($power != 0) ? $karma_which : 'karma_disabled';

$request = db_query("
SELECT subject
FROM {$db_prefix}messages
WHERE ID_MSG = {$message_id}
LIMIT 1", __FILE__, __LINE__);
list ($title) = mysql_fetch_row($request);
$title = mysql_real_escape_string($title);
mysql_free_result($request);

// Log this new action!
db_query("
REPLACE INTO {$db_prefix}log_karma
(`action`, `ID_TARGET`, `ID_EXECUTOR`, `logTime`, `comment`, `action_type`, `message`, `topic`, `title`)
VALUES
({$power}, {$uid}, {$ID_MEMBER}, " . time() . ", '{$comment}', '{$action_type}', {$message_id}, {$topic_id}, '{$title}')", __FILE__, __LINE__);

// Send them back to whence they came!
redirectexit('topic=' . $_POST['topic'] . '#msg' . $_POST['m']);
}

// For those poor souls without javascript support :(
function SendKarma()
{
global $modSettings, $user_info, $context, $txt, $ID_MEMBER, $db_prefix;

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

if(!isset($_GET['uid']) && !isset($_GET['m']) && !isset($_GET['topic']))
return ReputationLog();

// If you're a guest or can't do this, blow you off...
is_not_guest();
isAllowedTo('karma_edit');
checkSession('request');

// These _must_ be a number, no matter what.
$uid = (int) $_GET['uid'];
$message = (int) $_GET['m'];
$topic = (int) $_GET['topic'];

// You can't modify your own, punk! (use the profile if you need to.)
if (empty($uid) || $uid == $ID_MEMBER)
fatal_lang_error('smf61', false);

// If you don't have enough posts, tough luck.
// !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
if ($user_info['posts'] < $modSettings['karmaMinPosts'])
fatal_lang_error('smf60', true, array($modSettings['karmaMinPosts']));

$message_request = db_query("
SELECT *
FROM {$db_prefix}messages
WHERE id_msg = {$message}
LIMIT 1", __FILE__, __LINE__);

while($row = mysql_fetch_assoc($message_request)){
$context['message'] = $row;

$board_request = db_query("
SELECT *
FROM {$db_prefix}boards
WHERE id_board = " . $context['message']['ID_BOARD'], __FILE__, __LINE__);

$board = mysql_fetch_assoc($board_request);

// Load the membergroups allowed, and check permissions.
$board_groups = $board['memberGroups'] == '' ? array() : explode(',', $board['memberGroups']);
mysql_free_result($board_request);

// Kick 'em out if they don't have permission to view this topic!
if (count(array_intersect($user_info['groups'], $board_groups)) == 0 && !$user_info['is_admin'])
fatal_lang_error('topic_gone', false);

// Put it in quote tags to make it stand out a little... and because it's a quote.
$context['message']['body'] = "[quote author={$context['message']['posterName']} link=topic={$context['message']['ID_TOPIC']}.msg{$context['message']['ID_MSG']}#msg{$context['message']['ID_MSG']} date={$context['message']['posterTime']}]{$context['message']['body']}[/quote]";

// Amish girls gone wild!
censorText($context['message']['body']);
censorText($context['message']['subject']);

// Run BBC interpreter on the message.
$context['message']['body'] = parse_bbc($context['message']['body'], $context['message']['smileysEnabled'], $context['message']['ID_MSG']);
}

$context['sub_template'] = 'main';
$context['page_title'] = $txt['karma_add_to'];
$context['topic'] = $topic;
$context['m'] = $message;
$context['uid'] = $uid;
$context['can_pos_rep'] = allowedTo('positive_karma');
$context['can_neg_rep'] = allowedTo('negative_karma');

loadTemplate('Karma');
}

function ReputationLog()
{
global $modSettings, $context, $txt, $db_prefix, $scripturl;

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

// If you're a guest or can't do this, blow you off...
is_not_guest();
isAllowedTo('karma_edit');

// Set up the stuff and load the user.
$context['page_title'] = $txt['reputation_log'];
$context['start'] = isset($_GET['start']) ? (int) $_GET['start'] : 0;

$context['rep_sent'] = array();

$request = db_query("
SELECT COUNT(*) AS count
FROM {$db_prefix}log_karma", __FILE__, __LINE__);

list ($num_given) = mysql_fetch_row($request);
mysql_free_result($request);

$request = db_query("
SELECT k.*, r.realName AS receiver_name, s.realName AS sender_name
FROM {$db_prefix}log_karma AS k
LEFT JOIN {$db_prefix}members AS r ON (r.ID_MEMBER = k.ID_TARGET)
LEFT JOIN {$db_prefix}members AS s ON (s.ID_MEMBER = k.ID_EXECUTOR)
ORDER BY logTime DESC
LIMIT " . $context['start'] . ", 50", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)){
parsesmileys($row['comment']);

$context['rep_sent'][] = array(
'action_type' => !empty($row['action_type']) ? $row['action_type'] : ($row['action'] > 0) ? 'karmaGood' : 'karmaBad',
'executor' => array(
'name' => $row['sender_name'],
'id' => $row['ID_EXECUTOR'],
),
'target' => array(
'name' => $row['receiver_name'],
'id' => $row['ID_TARGET'],
),
'time' => timeformat($row['logTime']),
'comment' => stripslashes($row['comment']),
'topic_href' => $row['topic'] . '.msg' . $row['message'] . '#msg' . $row['message'],
'topic_title' => $row['title'],
);
}
mysql_free_result($request);

loadTemplate('Karma');
$context['sub_template'] = 'log';

// Construct the page index
$context['page_index'] = constructPageIndex($scripturl . '?action=reputation', $_REQUEST['start'], $num_given, 50);
}

ค้นหา -->>
โค๊ด: [Select]
// Modify a user's karma.
function ModifyKarma()
{

แก้เป็น -->>
โค๊ด: [Select]
/******************* Disabled by Advanced Reputation System **********************
**********************************************************************************
// Modify a user's karma the old and disgusting way...
function ModifyKarma_old()
{

ค้นหา -->>
โค๊ด: [Select]
obExit(false);
}
}

// What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No siree.
function BookOfUnknown()

แก้เป็น -->>
โค๊ด: [Select]
obExit(false);
}
}
**********************************************************************************
******************** Disabled by Advanced Reputation System *********************/

// What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No siree.
function BookOfUnknown()

file $sourcedir/Load.php

ค้นหา -->>
โค๊ด: [Select]
'time_offset' => empty($user_settings['timeOffset']) ? 0 : $user_settings['timeOffset'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'karmaGood' => empty($user_settings['karmaGood']) ? 0 : $user_settings['karmaGood'],
'karmaBad' => empty($user_settings['karmaBad']) ? 0 : $user_settings['karmaBad'],

ค้นหา -->>
โค๊ด: [Select]
mem.karmaGood, mem.ID_POST_GROUP, mem.karmaBad, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline,

แก้เป็น -->>
โค๊ด: [Select]
mem.karmaGood, mem.ID_POST_GROUP, mem.karmaBad, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline, mem.karma_disabled,

ค้นหา -->>
โค๊ด: [Select]
mem.birthdate, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin, mem.karmaGood,

แก้เป็น -->>
โค๊ด: [Select]
mem.birthdate, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin, mem.karmaGood, mem.karma_disabled,

ค้นหา -->>
โค๊ด: [Select]
$buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array();

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
$profile['karma_bars'] = array();

// If they are in the positives, and want it displayed
if(!$profile['karma_disabled'] && ($profile['karmaGood'] >= $profile['karmaBad'])){

$points = $profile['karmaGood'] - $profile['karmaBad'];
$power = ($points - ($points % $modSettings['karmaBarPower'])) / $modSettings['karmaBarPower'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars == 0 ? 1 : $bars;
$bars = ($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars;
$descriptions = preg_split("/(\r)?\n/", $modSettings['karmaDescriptions']);
$description = $descriptions[$bars - 1];

for($i = 0; $i < $bars; $i++)
$profile['karma_bars'][] = array(
'type' => 'Good_basic',
'desc' => $description
);

if($bars >= $modSettings['karmaSuperBar'])
for($i = ($modSettings['karmaSuperBar'] - 1); $i < $bars; $i++)
$profile['karma_bars'][$i]['type'] = 'Good_super';

// If they are in the negatives and want it displayed (or don't have a choice)
} else if(!$profile['karma_disabled']){

$points = $profile['karmaBad'] - $profile['karmaGood'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars == 0 ? 1 : $bars;
$bars = ($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars;

for($i = 0; $i < $bars; $i++)
$profile['karma_bars'][] = array(
'type' => 'Bad_basic',
'desc' => $modSettings['karmaNegativeDescription']
);

$power = 0;

if($bars >= $modSettings['karmaSuperBar'])
for($i = ($modSettings['karmaSuperBar'] - 1); $i < $bars; $i++)
$profile['karma_bars'][$i]['type'] = 'Bad_super';

// They don't want it displayed!
} else {

$profile['karma_bars'][] = array(
'type' => '_disabled_basic',
'desc' => $modSettings['karmaDisabledDescription']
);

$power = 0;

}

ค้นหา -->>
โค๊ด: [Select]
'good' => &$profile['karmaGood'],
'bad' => &$profile['karmaBad'],

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
'total' => $profile['karmaGood'] - $profile['karmaBad'],
'disabled' => &$profile['karma_disabled'],
'bars' => $profile['karma_bars'],
'power' => $power,

file $sourcedir/ManagePermissions.php

ค้นหา -->>
โค๊ด: [Select]
'view_mlist',
'karma_edit',

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Advanced Reputation System Settings
'disable_karma_display',
'positive_karma',
'negative_karma',
'delete_karma',

ค้นหา -->>
โค๊ด: [Select]
'karma_edit' => false,

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Advanced Reputation System Settings
'disable_karma_display' => false,
'positive_karma' => false,
'negative_karma' => false,
'delete_karma' => false,

ค้นหา -->>
โค๊ด: [Select]
$non_guest_permissions = array(

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Advanced Reputation System Settings
'disable_karma_display',
'positive_karma',
'negative_karma',
'delete_karma',

file $sourcedir/ManageServer.php

ค้นหา -->>
โค๊ด: [Select]
function saveDBSettings(&$config_vars)
{
foreach ($config_vars as $var)
{

แก้เป็น -->>
โค๊ด: [Select]
function saveDBSettings(&$config_vars)
{
if(isset($_POST['karmaDescriptions'])){
// Let's set two other ones, too!
$config_vars[] = array('int', 'karmaMaxBars');
$config_vars[] = array('int', 'karmaSuperBar');

$_POST['karmaDescriptions'] = trim($_POST['karmaDescriptions']);
$descriptions = count(preg_split("/(\r)?\n/", $_POST['karmaDescriptions']));

$_POST['karmaMaxBars'] = $descriptions;
$_POST['karmaSuperBar'] = ($descriptions - ($descriptions % 2))/2 + 1;
}

foreach ($config_vars as $var)
{

file $sourcedir/ModSettings.php

ค้นหา -->>
โค๊ด: [Select]
array('text', 'karmaSmiteLabel'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'',
// Advanced Reputation System Settings
array('int', 'karmaValuePost'),
array('int', 'karmaValueThread'),
array('int', 'karmaBarPower'),
array('int', 'karmaBarPoints'),
array('int', 'karmaRegistration'),
array('text', 'karmaMaxPerDay'),
array('text', 'karmaSpreadAround'),
array('large_text', 'karmaDescriptions'),
array('text', 'karmaDisabledDescription'),
array('text', 'karmaNegativeDescription'),

file $sourcedir/Post.php

ค้นหา -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];
}

// Posting a new topic.

แก้เป็น -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];

if(!$user_info['is_guest'] && $modSettings['karmaValuePost'] > 0){
$request = db_query("
UPDATE {$db_prefix}members
SET karmaGood = karmaGood + " . $modSettings['karmaValuePost'] . "
WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
}
}

// Posting a new topic.

ค้นหา -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];
}

// Modifying an existing message?

แก้เป็น -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];

if(!$user_info['is_guest'] && $modSettings['karmaValueThread'] > 0){
$request = db_query("
UPDATE {$db_prefix}members
SET karmaGood = karmaGood + " . $modSettings['karmaValueThread'] . "
WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
}
}

// Modifying an existing message?

file $sourcedir/Profile.php

ค้นหา -->>
โค๊ด: [Select]
'deleteAccount' => array(array('profile_remove_any', 'profile_remove_own'), array('profile_remove_any')),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'reputation' => empty($modSettings['karmaMode']) ? false : array(array('moderate_forum', 'profile_view_own'), array('moderate_forum')),

ค้นหา -->>
โค๊ด: [Select]
// Groups with moderator permissions can also....

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
if($context['user']['is_owner'] || allowedTo('moderate_forum'))
$context['profile_areas']['info']['areas']['reputation'] = '<a href="' . $scripturl . '?action=profile;u=' . $memID . ';sa=reputation">' . $txt['reputation'] . '</a>';

ค้นหา -->>
โค๊ด: [Select]
$context['allow_edit_title'] = allowedTo('profile_title_any') || (allowedTo('profile_title_own') && $context['user']['is_owner']);

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
$context['allow_disable_karma'] = allowedTo('disable_karma_display');

ค้นหา -->>
โค๊ด: [Select]
'bad' => empty($_POST['karmaBad']) ? '0' : $_POST['karmaBad'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'disabled' => (empty($_POST['karma_disabled']) || !allowedTo('disable_karma_display')),

ค้นหา -->>
โค๊ด: [Select]
'bad' => empty($user_profile[$memID]['karmaBad']) ? '0' : $user_profile[$memID]['karmaBad'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'disabled' => (empty($user_profile[$memID]['karma_disabled']) || !allowedTo('disable_karma_display')) ? 0 : 1,

ค้นหา -->>
โค๊ด: [Select]
'notify_announcements' => empty($_POST['notifyAnnouncements']) ? 0 : 1,

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'karma_disabled' => (empty($_POST['karma_disabled']) || !allowedTo('disable_karma_display')) ? 0 : 1,

ค้นหา -->>
โค๊ด: [Select]
'notifyAnnouncements', 'notifyOnce', 'notifySendBody'

แก้เป็น -->>
โค๊ด: [Select]
'notifyAnnouncements', 'notifyOnce', 'notifySendBody', 'karma_disabled'

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// View a summary. Includes the deletion of actions.
function reputation($memID)
{
global $context, $memberContext, $txt, $modSettings, $user_info, $user_profile, $sourcedir, $scripturl, $db_prefix;

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

// Attempt to load the member's profile data.
if (!loadMemberContext($memID) || !isset($memberContext[$memID]))
fatal_lang_error('not_a_user', false);

// Set up the stuff and load the user.
$context += array(
'page_title' => $txt['reputation'] . ' - ' . $memberContext[$memID]['name'],
'member' => &$memberContext[$memID],
'can_delete_karma' => allowedTo('karma_delete'),
'start' => isset($_GET['start']) ? (int) $_GET['start'] : 0,
);

$amount = 15;

// Are we deleting karma entries?
if(isset($_POST['deleteBoxes'])){
is_not_guest();
isAllowedTo('delete_karma');
checkSession('request');

foreach($_POST['deleteBoxes'] as $value)
if(!preg_match('/[0-9]+\|[0-9]+\|[0-9]{10}/', $value))
die("Hacker!!!");
else
$delete[] = explode('|', $value);

foreach($delete as $value){
$request = db_query("
SELECT action, action_type
FROM {$db_prefix}log_karma
WHERE ID_EXECUTOR = " . $value[1] . "
AND logTime = " . $value[2] . "
LIMIT 1", __FILE__, __LINE__);

// Reverse prior actions
while($row = mysql_fetch_assoc($request)){
loadMemberData($value[0]);
loadMemberContext($value[0], false);

if($row['action_type'] == 'karmaGood')
updateMemberData($value[0], array('karmaGood' => ($memberContext[$value[0]]['karma']['good'] - ((int) $row['action']))));
else if($row['action_type'] == 'karmaBad')
updateMemberData($value[0], array('karmaBad' => ($memberContext[$value[0]]['karma']['bad'] - ((int) $row['action']))));
}

mysql_free_result($request);

db_query("
DELETE
FROM {$db_prefix}log_karma
WHERE ID_EXECUTOR = " . $value[1] . "
AND logTime = " . $value[2], __FILE__, __LINE__);
}
}

// A list of actions they've been a part of
$request = db_query("
SELECT *
FROM {$db_prefix}log_karma
WHERE ID_TARGET = {$memID}
OR ID_EXECUTOR = {$memID}
LIMIT " . $context['start'] . ", {$amount}", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)){
// There are two types of rows - ones you sent, and ones you received.
if($row['ID_TARGET'] == $memID){
loadMemberData($row['ID_EXECUTOR']);
loadMemberContext($row['ID_EXECUTOR'], false);

parsesmileys($row['comment']);

$context['member']['karma_actions'][] = array(
'action_type' => !empty($row['action_type']) ? $row['action_type'] : (($row['action'] > 0) ? 'karmaGood' : 'karmaBad'),
'executor' => $memberContext[$row['ID_EXECUTOR']]['link'],
'target' => $txt['reputation_you'],
'time' => timeformat($row['logTime']),
'comment' => stripslashes($row['comment']),
'topic_href' => $row['topic'] . '.msg' . $row['message'] . '#msg' . $row['message'],
'topic_title' => $row['title'],
'delete_value' => $row['ID_TARGET'] . '|' . $row['ID_EXECUTOR'] . '|' . $row['logTime'],
);
} else {
loadMemberData($row['ID_TARGET']);
loadMemberContext($row['ID_TARGET'], false);

parsesmileys($row['comment']);

$context['member']['karma_actions'][] = array(
'action_type' => !empty($row['action_type']) ? $row['action_type'] : (($row['action'] > 0) ? 'karmaGood' : 'karmaBad'),
'executor' => $txt['reputation_you'],
'target' => $memberContext[$row['ID_TARGET']]['link'],
'time' => timeformat($row['logTime']),
'comment' => stripslashes($row['comment']),
'topic_href' => $row['topic'] . '.msg' . $row['message'] . '#msg' . $row['message'],
'topic_title' => $row['title'],
'delete_value' => $row['ID_TARGET'] . '|' . $row['ID_EXECUTOR'] . '|' . $row['logTime'],
);
}
}
mysql_free_result($request);

// And let's find out where the most are...
$request = db_query("
SELECT COUNT(*) AS num_rows
FROM {$db_prefix}log_karma
WHERE ID_TARGET = {$memID}
OR ID_EXECUTOR = {$memID}", __FILE__, __LINE__);

list ($total_actions) = mysql_fetch_row($request);
mysql_free_result($request);

// Construct the page index
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;sa=reputation;u=' . $memID, $context['start'], $total_actions, $amount);
}

file $sourcedir/RemoveTopic.php

ค้นหา -->>
โค๊ด: [Select]
iif (!empty($row['ID_MEMBER']) && $decreasePostCount && empty($row['countPosts']))
updateMemberData($row['ID_MEMBER'], array('posts' => '-'));

แก้เป็น -->>
โค๊ด: [Select]
if (!empty($row['ID_MEMBER']) && $decreasePostCount && empty($row['countPosts'])){
updateMemberData($row['ID_MEMBER'], array('posts' => '-'));
if($modSettings['karmaValuePost'] > 0){
db_query("
UPDATE {$db_prefix}members
SET karmaGood = karmaGood - " . $modSettings['karmaValuePost'] . "
WHERE ID_MEMBER = " . $row['ID_MEMBER'], __FILE__, __LINE__);
}
}

ค้นหา -->>
โค๊ด: [Select]
while ($rowMembers = mysql_fetch_assoc($requestMembers))
updateMemberData($rowMembers['ID_MEMBER'], array('posts' => 'posts - ' . $rowMembers['posts']));

แก้เป็น -->>
โค๊ด: [Select]
while ($rowMembers = mysql_fetch_assoc($requestMembers)){
updateMemberData($rowMembers['ID_MEMBER'], array('posts' => 'posts - ' . $rowMembers['posts']));
if($modSettings['karmaValueThread'] > 0){
db_query("
UPDATE {$db_prefix}members
SET karmaGood = karmaGood - " . ($rowMembers['posts'] * $modSettings['karmaValueThread']) . "
WHERE ID_MEMBER = " . $rowMembers['ID_MEMBER'], __FILE__, __LINE__);
}
}

file $sourcedir/Stats.php

ค้นหา -->>
โค๊ด: [Select]
function DisplayStats()
{
global $txt, $scripturl, $db_prefix, $modSettings, $user_info, $context;

แก้เป็น -->>
โค๊ด: [Select]
function DisplayStats()
{
global $txt, $scripturl, $db_prefix, $modSettings, $user_info, $context, $settings;

ค้นหา -->>
โค๊ด: [Select]
// Topic replies top 10.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Highest reputation, but only if reputation is enabled.
if(!empty($modSettings['karmaMode'])){
$descriptions = preg_split("/(\r)?\n/", $modSettings['karmaDescriptions']);

$context['reputation_best'] = array();
$context['reputation_worst'] = array();

$result = db_query("
SELECT (karmaGood - karmaBad) AS karma, ID_MEMBER, realName
FROM {$db_prefix}members
WHERE karmaGood > karmaBad
ORDER BY karma DESC
LIMIT 10", __FILE__, __LINE__);

while($row = mysql_fetch_assoc($result)){
$rep_bars = '';

$points = $row['karma'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars < 1 ? 1 : (($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars);
$description = $descriptions[$bars - 1];

for($i = 0; $i < $bars; $i++)
$rep_bars .= '<img src="' . $settings['images_url'] . '/karmaGood_' . ($i < ($modSettings['karmaSuperBar'] - 1) ? 'basic' : 'super') . '.gif" title="' . $row['realName'] . ' ' . $description . '" alt="' . $row['realName'] . ' ' . $description . '" />';

$context['reputation_best'][] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'reputation_bars' => $rep_bars,
'amount' => '+' . $row['karma'],
);
}

mysql_free_result($result);

$result = db_query("
SELECT (karmaBad - karmaGood) AS karma, ID_MEMBER, realName
FROM {$db_prefix}members
WHERE karmaBad > karmaGood
ORDER BY karma DESC
LIMIT 10", __FILE__, __LINE__);

while($row = mysql_fetch_assoc($result)){
$rep_bars = '';

$points = $row['karma'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars < 1 ? 1 : (($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars);

for($i = 0; $i < $bars; $i++)
$rep_bars .= '<img src="' . $settings['images_url'] . '/karmaBad_' . ($i < ($modSettings['karmaSuperBar'] - 1) ? 'basic' : 'super') . '.gif" title="' . $row['realName'] . ' ' . $modSettings['karmaNegativeDescription'] . '" alt="' . $row['realName'] . ' ' . $modSettings['karmaNegativeDescription'] . '" />';

$context['reputation_worst'][] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'reputation_bars' => $rep_bars,
'amount' => '-' . $row['karma'],
);
}

mysql_free_result($result);
}

file $sourcedir/Subs-Members.php

ค้นหา -->>
โค๊ด: [Select]
'smileySet' => "''",

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'karmaGood' => ($modSettings['karmaRegistration'] > 0) ? $modSettings['karmaRegistration'] : 0,
'karmaBad' => 0,

ลิงค์หัวข้อ: http://dexmore.com/topic/1872
Windows XP    Firefox 3.6.3   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 2 เมื่อ: 9 มิถุนายน 2553, 10:50:47
สร้างไฟล์: Karma.template.php เอาไว้ใน -->> $boarddir/Themes/default
โค๊ด: [Select]
<?php
// Version: 2.0 RC1; Karma
// This file is part of the Advanced Reputation System

// For the poor souls without javascript :(
function template_main()
{
global $txt$context$user_info$scripturl$settings;

echo '
<form name="reputation_form" action="'
$scripturl'?action=modifykarma" method="post" accept-charset="'$context['character_set'], '" class="reputation_form">
<table border="0" cellspacing="0" cellpadding="8" align="center" class="tborder" width="80%">
<tr class="titlebg">
<td colspan="2">'
, !empty($settings['use_buttons']) ? '<img src="' $settings['images_url'] . '/karma.gif" align="right" style="margin-right: 4px;" alt="" />' ''$txt['karma_your_opinion'], '</td>
</tr>
<tr>
<td class="windowbg" colspan="2">
'
$context['message']['body'], '
</td>
</tr>
<tr>
<td class="windowbg" align="center" style="padding: 1em 2em 1em 2em;">
<input type="radio" name="type" value="agree"'
, !$context['can_pos_rep'] ? ' disabled="disabled"' ' checked="checked"'' /> '$txt['karma_agree'], '
<input type="radio" name="type" value="disagree"'
, !$context['can_neg_rep'] ? ' disabled="disabled"' : !$context['can_pos_rep'] ? ' checked="checked"' ''' /> '$txt['karma_disagree'], '
</td>
<td class="windowbg" align="center" style="padding: 1em 2em 1em 2em;">
'
$txt['comment'], ': <input type="text" size="50" name="reputation_comment" />
<input type="submit" value="'
$txt['submit'], '" />
<input type="hidden" name="topic" value="'
$context['topic'], '" />
<input type="hidden" name="sc" value="'
$context['session_id'], '" />
<input type="hidden" name="uid" value="'
$context['uid'], '" />
<input type="hidden" name="m" value="'
$context['m'], '" />
</td>
</tr>
</table>
</form>'
;
}

// License and registration, please. No? Okay, just your reputation log.
function template_log()
{
global $txt$context$user_info$scripturl$settings;

echo '
<table width="90%" border="0" cellpadding="4" cellspacing="1" align="center" class="bordercolor">
<tr class="titlebg">
<td colspan="6">'
, !empty($settings['use_buttons']) ? '<img src="' $settings['images_url'] . '/karma.gif" align="right" style="margin-right: 4px;" alt="" />' ''$txt['reputation_log'], '</td>
</tr>'
;

if(empty($context['rep_sent']))
echo '
<tr class="windowbg">
<td colspan="6">
'
$txt['no_reputation_log'], '
</td>
</tr>'
;
else {
echo '
<tr class="catbg2">
<td width="1%">
&nbsp;
</td>
<td width="15%">
'
$txt[318], '
</td>
<td width="15%">
'
$txt[324], '
</td>
<td width="25%">
'
$txt[118], '
</td>
<td width="14%">
'
$txt[317], '
</td>
<td width="30%">
'
$txt['comment'], '
</td>
</tr>'
;

$which false;

foreach($context['rep_sent'] as $rep_sent){
$which = !$which;

echo '
<tr class="windowbg'
$which '2' '''">
<td align="center">
<img src="'
$settings['images_url'], '/'$rep_sent['action_type'], '_basic.gif" />
</td>
<td>
<a href="'
$scripturl'?action=profile;u='$rep_sent['executor']['id'], '">'$rep_sent['executor']['name'], '</a>
</td>
<td>
<a href="'
$scripturl'?action=profile;u='$rep_sent['target']['id'], '">'$rep_sent['target']['name'], '</a>
</td>
<td>
<a href="'
$scripturl'?topic='$rep_sent['topic_href'], '">'$rep_sent['topic_title'], '</a>
</td>
<td>
'
$rep_sent['time'], '
</td>
<td>
'
$rep_sent['comment'], '
</td>
</tr>'
;
}

echo '
<tr class="catbg2">
<td colspan="6">'
$txt[139], ': '$context['page_index'], '</td>
</tr>'
;
}

echo '
</table>'
;
}
?>

สร้างไฟล์: install.php เพื่อสร้างฐานข้อมูล เอาไว้ใน $boarddir (ที่เดียวกับไฟล์ SSI.php) รัน http://www.your_url.xxx/$boarddir/install.php -->> Enter เสร็จแล้วลบทิ้ง
โค๊ด: [Select]
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
else if(!
defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php and SSI.php files.');

if ((
SMF == 'SSI') && !$user_info['is_admin'])
die('Admin priveleges required.');

$result db_query("
SHOW FIELDS
FROM {$db_prefix}members"
__FILE____LINE__);

while (
$row mysql_fetch_assoc($result))
$members[] = $row['Field'];

mysql_free_result($result);

$result db_query("
SHOW FIELDS
FROM {$db_prefix}log_karma"
__FILE____LINE__);

while (
$row mysql_fetch_assoc($result))
$log_karma[] = $row['Field'];

mysql_free_result($result);

//
// Empty out the karma log if this is your first time installing this mod
//

if (!in_array('karma_disabled'$members))
db_query("
DELETE FROM {$db_prefix}log_karma"
__FILE____LINE__);

//
// Settings table
//

db_query("
INSERT IGNORE INTO {$db_prefix}settings
(`variable`, `value`)
VALUES
('karmaBarPower', '100'),
('karmaBarPoints', '1000'),
('karmaMaxBars', '12'),
('karmaSuperBar', '7'),
('karmaSpreadAround', '3'),
('karmaValuePost', '1'),
('karmaValueThread', '3'),
('karmaMaxPerDay', '10'),
('karmaRegistration', '100'),
('karmaNegativeDescription', 'is looked down upon.'),
('karmaDisabledDescription', 'hides in shadows.'),
('karmaDescriptions', 'has no influence.
barely matters.
is working their way up.
might someday be someone...
is on the verge of being accepted.
is a rising star!
has a powerful will.
is a force to reckon with.
has great potential!
has an aura about them.
is leading the good life!
is awe-inspiring!')"
__FILE____LINE__);

db_query("
REPLACE INTO {$db_prefix}settings
(`variable`, `value`)
VALUES
('karmaLabel', 'Reputation:')"
__FILE____LINE__);

//
// Members table
//

if (!in_array('karma_disabled'$members))
db_query("
ALTER TABLE {$db_prefix}members
ADD karma_disabled TINYINT(3) NOT NULL default '0'"
__FILE____LINE__);

db_query("
ALTER TABLE {$db_prefix}members
CHANGE COLUMN karmaGood karmaGood INT(8) NOT NULL"
__FILE____LINE__);

db_query("
ALTER TABLE {$db_prefix}members
CHANGE COLUMN karmaBad karmaBad INT(8) NOT NULL"
__FILE____LINE__);

//
// Karma Log columns
//

if (!in_array('comment'$log_karma))
db_query("
ALTER TABLE {$db_prefix}log_karma
ADD comment TINYTEXT NOT NULL"
__FILE____LINE__);

if (!
in_array('action_type'$log_karma))
db_query("
ALTER TABLE {$db_prefix}log_karma
ADD action_type VARCHAR(15) NOT NULL"
__FILE____LINE__);

if (!
in_array('topic'$log_karma))
db_query("
ALTER TABLE {$db_prefix}log_karma
ADD topic INT(12) NOT NULL"
__FILE____LINE__);

if (!
in_array('title'$log_karma))
db_query("
ALTER TABLE {$db_prefix}log_karma
ADD title TINYTEXT NOT NULL"
__FILE____LINE__);

if (!
in_array('message'$log_karma))
db_query("
ALTER TABLE {$db_prefix}log_karma
ADD message INT(12) NOT NULL"
__FILE____LINE__);

db_query("
ALTER TABLE {$db_prefix}log_karma
CHANGE COLUMN action action INT(8) NOT NULL"
__FILE____LINE__);

db_query("
ALTER TABLE {$db_prefix}log_karma
DROP PRIMARY KEY"
__FILE____LINE__);

db_query("
ALTER TABLE {$db_prefix}log_karma
ADD PRIMARY KEY (`id_executor`, `topic`, `message`)"
__FILE____LINE__);

if (
SMF == 'SSI')
echo 'Database changes are complete!';
?>

ดาวน์โหลด: images.rar แตกไฟล์แล้วอัพโหลดโฟลเดอร์ images ไปไว้ใน -->> $boarddir/Themes/ธีมที่ใช้
ขออภัย! ส่วนนี้สงวนไว้เฉพาะสมาชิกเท่านั้น กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

การตั้งค่า: ผู้ดูแล --> ส่วนปรับแต่งค่าการใช้งาน --> คะแนนเสียง
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

ลิงค์หัวข้อ: http://dexmore.com/topic/1872
Windows XP    Firefox 3.6.3   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 3 เมื่อ: 24 มิถุนายน 2553, 17:04:10
สำหรับ SMF 2.0.xx

แก้ไขไฟล์:

file $boarddir/index.php

ค้นหา -->>
โค๊ด: [Select]
'reporttm' => array('SendTopic.php', 'ReportToModerator'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'reputation' => array('Karma.php', 'SendKarma'),

file $themedir/Display.template.php

ค้นหา -->>
โค๊ด: [Select]
global $context, $settings, $options, $txt, $scripturl, $modSettings;

แก้เป็น -->>
โค๊ด: [Select]
global $context, $settings, $options, $txt, $scripturl, $modSettings, $user_info;

ค้นหา -->>
โค๊ด: [Select]
<a id="top">

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
<span id="reputation_menu" style="visibility: hidden; display: none;">
<div class="windowbg2">
<strong>', $txt['karma_add_to'], ': <span id="reputation_name">&nbsp;</span></strong>
<fieldset>
<legend>', $txt['karma_your_opinion'], '</legend>
<form id="reputation_form" name="reputation_form" action="', $scripturl, '?action=modifykarma" method="post" accept-charset="', $context['character_set'], '" class="reputation_form" onsubmit="aReputation[0].sendRep(); return false;">
<input type="radio" name="type" value="agree"', !$context['can_pos_rep'] ? ' disabled="disabled"' : ' checked="checked"', ' /> ', $txt['karma_agree'], '
<input type="radio" name="type" value="disagree"', !$context['can_neg_rep'] ? ' disabled="disabled"' : !$context['can_pos_rep'] ? ' checked="checked"' : '', ' /> ', $txt['karma_disagree'], '
<span id="reputation_fields">&nbsp;</span>
<br />
', $txt['comment'], ': <input type="text" name="reputation_comment" /><br />
<br />
<input type="submit" value="', $txt['submit'], '" />
<input type="hidden" name="topic" value="', $context['current_topic'], '.', $context['start'], '" />
<input type="hidden" id="sessionid" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</fieldset>
<script language="JavaScript" type="text/javascript"><!-- // -->
// Ajaxify that reputation box!
if (typeof(window.XMLHttpRequest) != "undefined")
{
aReputation[0] = new Reputation({
sBackReference: "aReputation[0]",
sScriptUrl: "', $scripturl, '"
});
}
</script>
</div>
</span>

ค้นหา -->>
โค๊ด: [Select]
// Is karma display enabled?  Total or +/-?
if ($modSettings['karmaMode'] == '1')
echo '
<li class="karma">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';
elseif ($modSettings['karmaMode'] == '2')
echo '
<li class="karma">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';

// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<li class="karma_allow">
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.' . $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a>
<a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';m=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>
</li>';

แก้เป็น -->>
โค๊ด: [Select]
// Is karma display enabled?
if ($modSettings['karmaMode'] != '0')
{
echo '
<li class="karma">', $txt['karma_power'], ': ', $message['member']['karma']['power'], '</li>
<li class="karma_allow repbars">
';
foreach($message['member']['karma']['bars'] as $karma_bar)
echo '<img src="', $settings['images_url'], '/karma_', $karma_bar['type'], '.gif" title="', $message['member']['name'], ' ', $karma_bar['desc'], '" alt="', $message['member']['name'], ' ', $karma_bar['desc'], '" />';

echo '
</li>';
}

ค้นหา -->>
โค๊ด: [Select]
// Since we know this person isn't a guest, you *can* message them.
if ($context['can_send_pm'])
echo '
<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '" border="0" />' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>';

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]

// Is this user allowed to modify this member's karma?
if (($context['can_pos_rep'] || $context['can_neg_rep']) && $message['can_send_karma'] && ($user_info['id'] != $message['member']['id']))
echo '
<span style="visibility: hidden; display: none;" id="reputation_form_', $message['id'], '">
<input type="hidden" name="uid" value="', $message['member']['id'], '" />
<input type="hidden" name="m" value="', $message['id'], '" />
</span>
<li><a id="repicon" onclick="reputationForm(\'reputation_form_', $message['id'], '\', \'', $message['member']['name'], '\', this, event); return false;" href="', $scripturl, '?action=reputation;uid=', $message['member']['id'], ';m=', $message['id'], ';topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="', $settings['images_url'], '/karma.gif" alt="', $txt['add_karma'], '" title="', $txt['add_karma'], '" /></a></li>';

file $themedir/PersonalMessage.template.php

ค้นหา -->
โค๊ด: [Select]
// Is karma display enabled?  Total or +/-?
if ($modSettings['karmaMode'] == '1')
echo '
<li class="karma">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</li>';
elseif ($modSettings['karmaMode'] == '2')
echo '
<li class="karma">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</li>';

// Is this user allowed to modify this member's karma?
if ($message['member']['karma']['allow'])
echo '
<li class="karma_allow">
<a href="', $scripturl, '?action=modifykarma;sa=applaud;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaApplaudLabel'], '</a> <a href="', $scripturl, '?action=modifykarma;sa=smite;uid=', $message['member']['id'], ';f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pm=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $modSettings['karmaSmiteLabel'], '</a>
</li>';

แก้เป็น -->>
โค๊ด: [Select]
// Karma removed by the Advanced Reputation System - who ever though karma in PMs was a good decision?

file $themedir/Profile.template.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Shows recent reputation actions, and allows moderators to moderate them.
function template_reputation()
{
global $context, $settings, $options, $scripturl, $modSettings, $txt;

echo '
<h3 class="titlebg">
<span class="left"></span>
<img src="', $settings['images_url'], '/karma.gif" alt="" /> ', $txt['karma_latest_title'], '
</h3>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">';

if(empty($context['member']['karma_actions']))
echo '
', $txt['no_reputation_actions'];
else
{
// If they can delete karma actions, start the form
if($context['can_delete_karma'])
echo '
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=reputation" method="post" accept-charset="', $context['character_set'], '">
<input type="hidden" name="uid" value="', $context['id_member'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />';

echo '
<table border="0" cellspacing="0" cellpadding="8" width="100%">
<tr class="windowbg" style="font-weight: bold;">
<td width="1%">&nbsp;</td>
<td width="', $context['can_delete_karma'] ? '29' : '30', '%">', $txt['topic'], '</td>
<td width="15%">', $txt['date'], '</td>
<td width="30%">', $txt['comment'], '</td>
<td width="12%">', $txt['to'], '</td>
<td width="12%">', $txt['from'], '</td>', $context['can_delete_karma'] ? '
<td width="1%"><input type="checkbox" onclick="invertAll(this, this.form);" class="check" /></td>' : '', '
</tr>';

$which = false;

foreach($context['member']['karma_actions'] as $karma)
{
$which = !$which;

echo '
<tr class="windowbg', $which ? '2' : '', '">
<td align="center"><img src="', $settings['images_url'], '/', $karma['action_type'], '_basic.gif" /></td>
<td><a href="', $scripturl, '?topic=', $karma['topic_href'], '">', $karma['topic_title'], '</a></td>
<td>', $karma['time'], '</td>
<td>', $karma['comment'], '</td>
<td>', $karma['target'], '</td>
<td>', $karma['executor'], '</td>', $context['can_delete_karma'] ? '
<td align="center"><input type="checkbox" name="deleteBoxes[]" value="' . $karma['delete_value'] . '" class="check" /></td>' : '', '
</tr>';
}

echo '
</table>
<br />
<strong>', $txt['pages'], ': ', $context['page_index'], '</strong>';


// If they can delete karma actions, end the old
if($context['can_delete_karma'])
echo '
<br />
<div width="100%" align="right">
<input class="button_submit" type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['quickmod_confirm'], '\')) return false;" /></span>
</div>
</form>';
}

echo '
</div>
<span class="botslice"><span></span></span>
</div>
<br />';
}

file $themedir/Stats.template.php

ค้นหา -->>
โค๊ด: [Select]
</div>
</div>
<div class="flow_hidden">
<div id="top_topics_replies">

แก้เป็น -->>
โค๊ด: [Select]
</div>
</div>';

if(!empty($modSettings['karmaMode']))
{
echo '
<div class="flow_hidden">
<div id="best_karma">
<h3 class="catbg"><span class="left"></span>
<img src="', $settings['images_url'], '/stats_posters.gif" class="icon" alt="" /> ', $txt['best_karma'], '
</h3>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
<dl class="stats">';

if(!empty($context['reputation_best']))
foreach ($context['reputation_best'] as $member)
echo '
<dt>
', $member['link'], ' (', $member['amount'], ')
</dt>
<dd class="statsbar">
<span class="repbars">', $member['reputation_bars'], '</span>
</dd>';

echo '
</dl>
<div class="clear"></div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>
<div id="worst_karma">
<h3 class="catbg"><span class="left"></span>
<img src="', $settings['images_url'], '/stats_posters.gif" class="icon" alt="" /> ', $txt['worst_karma'], '
</h3>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
<dl class="stats">';

if(!empty($context['reputation_worst']))
foreach ($context['reputation_worst'] as $member)
echo '
<dt>
', $member['link'], ' (', $member['amount'], ')
</dt>
<dd class="statsbar">
<span class="repbars">', $member['reputation_bars'], '</span>
</dd>';

echo '
</dl>
<div class="clear"></div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>
</div>';
}

echo '
<div class="flow_hidden">
<div id="top_topics_replies">

file $themedir/Xml.template.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
function template_reputation()
{
global $context, $settings, $options, $txt;

echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
<smf>';

if($context['error_txt'] == "")
echo '
<result>', cleanXml($txt['reputation_sent']), '</result>';
else
echo '
<error>', cleanXml($context['error_txt']), '</error>';

echo '
</smf>';
}

file $themedir/scripts/script.js

เพิ่ม -->>
โค๊ด: [Select]

var disappeardelay = 30 * 1000; // karma box hide display time, in milliseconds
var vertical_offset = "0px"; // vertical offset of karma box from image
var horizontal_offset = "-3px"; // horizontal offset of karma box from image

function getposOffset(what, offsettype)
{
var totaloffset = (offsettype=="left") ? what.offsetLeft : what.offsetTop;
var parentEl = what.offsetParent;

while (parentEl!=null)
{
totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
parentEl = parentEl.offsetParent;
}

return totaloffset;
}

function showhiderep(obj, e)
{
rep_box.style.left = rep_box.style.top = -500;
rep_box.widthobj = rep_box.style;
rep_box.widthobj.width = '300px';

if (obj.visibility == "visible"){
obj.visibility = "hidden";
obj.display = "none";
}
else
{
obj.visibility = "visible";
obj.display = "block";
}
}

function reputationForm(rep_contents, member_name, obj, e)
{
if(window.event)
event.cancelBubble = true;
else if(e.stopPropagation)
e.stopPropagation();

clearhidebox();

rep_box = document.getElementById("reputation_menu");
rep_fields = document.getElementById("reputation_fields");
rep_name = document.getElementById("reputation_name");
setInnerHTML(rep_fields, getInnerHTML(document.getElementById(rep_contents)));
setInnerHTML(rep_name, member_name);

showhiderep(rep_box.style, e);

rep_box.x = getposOffset(obj, "left");
rep_box.y = getposOffset(obj, "top");
rep_box.style.left = rep_box.x + "px";
rep_box.style.top = rep_box.y + obj.offsetHeight + "px";

delayhidebox();
}

function hidebox(e)
{
if(typeof rep_box != "undefined")
rep_box.style.visibility = "hidden";
}

function delayhidebox()
{
delayhide = setTimeout("hidebox()", disappeardelay);
}

function clearhidebox()
{
if(typeof delayhide != "undefined")
clearTimeout(delayhide);
}

var aReputation = new Array();

// *** Reputation object.
function Reputation(oOptions)
{
if (!this.isXmlHttpCapable())
return;

this.opt = oOptions;
this.funcParent = this;
}

// Determine whether the quick modify can actually be used.
Reputation.prototype.isXmlHttpCapable = function ()
{
if (typeof(window.XMLHttpRequest) == 'undefined')
return false;

// Opera didn't always support POST requests. So test it first.
if (typeof(window.opera) != 'undefined')
{
var test = new XMLHttpRequest();
if (typeof(test.setRequestHeader) != 'function')
return false;
}

return true;
}

// The function called after a user wants to save his precious message.
Reputation.prototype.sendRep = function (sSessionId)
{
var i, x = new Array();
var form = document.forms.reputation_form.elements;
x[x.length] = 'reputation_comment=' + escape(form['reputation_comment'].value.replace(/&#/g, "&#38;#").php_to8bit()).replace(/\+/g, "%2B");
x[x.length] = 'topic=' + parseInt(form['topic'].value);
x[x.length] = 'uid=' + parseInt(form['uid'].value);
x[x.length] = 'm=' + parseInt(form['m'].value);
x[x.length] = 'type=' + (form['type'][0].checked ? form['type'][0].value : form['type'][1].value);
x[x.length] = document.getElementById('sessionid').name + '=' + document.getElementById('sessionid').value;

// Happy Easter!
if(form['reputation_comment'].value == "about:reputation"){
alert("Version 1.7, for SMF 2.0 RC1. Code by Fustrate (http://www.fustrate.com/), who is pretty awesome.");
return;
}

// Send in the XMLhttp request and let's hope for the best.
ajax_indicator(true);
sendXMLDocument.call(this, smf_prepareScriptUrl(this.opt.sScriptUrl) + "action=xmlhttp;sa=reputation;xml", x.join("&"), this.onRepDone);

return false;
}

// Callback function of the XMLhttp request sending the modified message.
Reputation.prototype.onRepDone = function (XMLDoc)
{
// We've finished the loading stuff.
ajax_indicator(false);
hidebox();

// If we didn't get a valid document, just cancel.
if (!XMLDoc || !XMLDoc.getElementsByTagName('smf')[0])
return;

var result = XMLDoc.getElementsByTagName('smf')[0].getElementsByTagName('result')[0];
var error = XMLDoc.getElementsByTagName('smf')[0].getElementsByTagName('error')[0];

if (result)
{
alert(result.childNodes[0].nodeValue);
document.getElementById('repicon').style.display = 'none';
document.getElementById('repicon').style.visibility = 'hidden';
}
else if (error)
alert(error.childNodes[0].nodeValue);
}

file $themedir/css/index.css

เพิ่ม -->>
โค๊ด: [Select]
.repbars img
{
padding: 0 1px 0 0;
}

#reputation_menu{
position: absolute;
border: 1px solid black;
z-index: 100;
}

file $sourcedir/Display.php

ค้นหา -->>
โค๊ด: [Select]
'can_see_ip' => allowedTo('moderate_forum') || ($message['id_member'] == $user_info['id'] && !empty($user_info['id'])),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'can_send_karma' => empty($message['is_repped']) && ($user_info['id'] != $message['id_member']),

ค้นหา -->>
โค๊ด: [Select]
$messages_request = $smcFunc['db_query']('', '
SELECT
id_msg, icon, subject, poster_time, poster_ip, id_member, modified_time, modified_name, body,
smileys_enabled, poster_name, poster_email, approved,
id_msg_modified < {int:new_from} AS is_read
FROM {db_prefix}messages
WHERE id_msg IN ({array_int:message_list})
ORDER BY id_msg' . (empty($options['view_newest_first']) ? '' : ' DESC'),
array(
'message_list' => $messages,
'new_from' => $topicinfo['new_from'],
)
);

แก้เป็น -->>
โค๊ด: [Select]
$messages_request = $smcFunc['db_query']('', '
SELECT
m.id_msg, m.icon, m.subject, m.poster_time, m.poster_ip, m.id_member, m.modified_time, m.modified_name, m.body,
m.smileys_enabled, m.poster_name, m.poster_email, m.approved,
m.id_msg_modified < {int:new_from} AS is_read, k.message AS is_repped
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}log_karma AS k ON (k.message = m.id_msg AND k.id_executor = {int:current_member})
WHERE m.id_msg IN ({array_int:message_list})
ORDER BY m.id_msg' . (empty($options['view_newest_first']) ? '' : ' DESC'),
array(
'message_list' => $messages,
'new_from' => $topicinfo['new_from'],
'current_member' => $user_info['id'],
)
);

ค้นหา -->>
โค๊ด: [Select]
$context['can_reply'] |= $context['can_reply_unapproved'];

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
$context['can_pos_rep'] = allowedTo('positive_karma');
$context['can_neg_rep'] = allowedTo('negative_karma');

file $sourcedir/Karma.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Modify a user's karma, only better than the old one!
function ModifyKarma()
{
global $modSettings, $txt, $user_info, $smcFunc;

// A fix for templates that don't get edited correctly, and still show the old links.
if(isset($_GET['sa']) && ($_GET['sa'] == 'applaud' || $_GET['sa'] == 'smite'))
redirectexit('action=reputation;uid=' . $_GET['uid'] . ';m=' . $_GET['m'] . ';topic=' . $_GET['topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

// These _must_ be numbers, no matter what.
$uid = (int) $_POST['uid'];
$message_id = (int) $_POST['m'];
$topic_id = (int) $_POST['topic'];

// If you're a guest or can't do this, blow you off...
is_not_guest();
isAllowedTo('karma_edit');

checkSession('request');

// If you don't have enough posts, tough luck.
// !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
if ($user_info['posts'] < $modSettings['karmaMinPosts'])
fatal_lang_error('not_enough_posts_karma', true, array($modSettings['karmaMinPosts']));

// And you can't modify your own, punk! (use the profile if you need to, admins!)
if (empty($uid) || $uid == $user_info['id'])
fatal_lang_error('cant_change_own_karma', false);

// Find their (super)power (and their secret identity)! Can't go into negatives...
$points = $user_info['karma_good'] - $user_info['karma_bad'];
$power = ($points - ($points % $modSettings['karmaBarPower'])) / $modSettings['karmaBarPower'];
$power = (int) (($power > 0) ? $power : 0);

// !!! Should use a modSetting for 300
$comment = (strlen($_POST['reputation_comment']) > 300) ? substr($_POST['reputation_comment'], 0, 300) : $_POST['reputation_comment'];

// I fart in your general direction!
if (strtolower($comment) == 'your mother was a hamster and your father smelt of elderberries!')
fatal_error('...and Saint Attila raised the hand grenade up on high, saying, "O Lord, bless this Thy hand grenade that with it Thou mayest blow Thine enemies to tiny bits, in Thy mercy." And the Lord did grin and the people did feast upon the lambs and sloths and carp and anchovies and orangutans and breakfast cereals, and fruit bats and large chu... *ahem* And the Lord spake, saying, "First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who being naughty in my sight, shall snuff it." Amen.', false);

//Find the time 24 hours ago... but wait... what if karmaWaitTime is greater than 24?! Bad var name, but who gives a hoot, if it works?
$yesterday = time() - 86400;
$longtimeago = time() - (60 * 60 * ($modSettings['karmaWaitTime']));
$hoursAgo = ($modSettings['karmaWaitTime'] < 24) ? $yesterday : $longtimeago;

// Applauding or smiting? Don't try to do a cheap javascript injection on me...
switch ($_POST['type'])
{
case 'agree':
if(!allowedTo('positive_karma'))
fatal_lang_error('karma_cant_agree', false);
$karma_which = 'karma_good';
break;
case 'disagree':
if(!allowedTo('negative_karma'))
fatal_lang_error('karma_cant_disagree', false);
$karma_which = 'karma_bad';
break;
default:
// Should never get here
fatal_lang_error('karma_choose_action', false);
}

// Going in order of permissions... it only gets added if it passes all of the tests!

// Used up all of their $modSettings['karmaMaxPerDay'] ?
if (!empty($modSettings['karmaMaxPerDay']) && ($modSettings['karmaMaxPerDay'] > 0))
{
// Find out if this user has done this in the past 24 hours.
$request = $smcFunc['db_query']('', '
SELECT log_time
FROM {db_prefix}log_karma
WHERE id_executor = {int:current_member}
AND log_time >= {int:yesterday}',
array(
'current_member' => $user_info['id'],
'yesterday' => $hoursAgo,
)
);

if ($smcFunc['db_num_rows']($request) >= $modSettings['karmaMaxPerDay']){ // but why would they be over?
$smcFunc['db_free_result']($request);
fatal_lang_error('karma_maxed_out', false, array($modSettings['karmaMaxPerDay']));
}

$smcFunc['db_free_result']($request);
}

// Haven't waited long enough?
if (!empty($modSettings['karmaWaitTime']) && (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum')) && $modSettings['karmaWaitTime'] > 0)
{
// Find out if this user has done this in the past $longenough.
$request = $smcFunc['db_query']('', '
SELECT log_time
FROM {db_prefix}log_karma
WHERE id_executor = {int:current_member}
AND log_time >= {int:waittime}
LIMIT 1',
array(
'current_member' => $user_info['id'],
'waittime' => $longtimeago,
)
);

if ($smcFunc['db_num_rows']($request) > 0)
{
// Give them approximate minutes until they can, to be nice ;)
list ($log_time) = $smcFunc['db_fetch_row']($request);
$log_time_wait = ($log_time + (60 * 60 * $modSettings['karmaWaitTime'])) - time(); // seconds
$log_time_wait = ($log_time_wait - ($log_time_wait % 60)) / 60; // minutes
$smcFunc['db_free_result']($request);
fatal_lang_error('karma_please_wait', false, array($modSettings['karmaWaitTime'], $log_time_wait));
}

$smcFunc['db_free_result']($request);
}

// Need to spread it around a bit? No, not the flu, silly!
if (!empty($modSettings['karmaSpreadAround']) && ($modSettings['karmaSpreadAround'] > 0))
{
// Grab the latest karmaSpreadAround actions - if the target is in there, throw an error!
$request = $smcFunc['db_query']('', '
SELECT id_target
FROM {db_prefix}log_karma
WHERE id_executor = {int:current_member}
ORDER BY log_time DESC
LIMIT {int:spread}',
array(
'current_member' => $user_info['id'],
'spread' => $modSettings['karmaSpreadAround'],
)
);

if ($smcFunc['db_num_rows']($request) > 0)
while($row = $smcFunc['db_fetch_assoc']($request))
if($row['id_target'] == $uid)
fatal_lang_error('karma_spread_around', false);

$smcFunc['db_free_result']($request);
}

// One last test - have they already sent rep to this particular post?
$request = $smcFunc['db_query']('', '
SELECT log_time
FROM {db_prefix}log_karma
WHERE id_executor = {int:executor}
AND message = {string:message}
LIMIT 1',
array(
'executor' => $user_info['id'],
'message' => $message_id
)
);

if($smcFunc['db_num_rows']($request) != 0)
fatal_lang_error('karma_sent_twice', false);

$smcFunc['db_free_result']($request);

// Finally! Now do an update

$request = $smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET {raw:which} = {raw:which} + {int:power}
WHERE id_member = {int:uid}',
array(
'power' => $power,
'uid' => $uid,
'which' => $karma_which,
)
);

if(!$request)
fatal_lang_error('karma_didnt_update', false);

$action_type = ($power != 0) ? $karma_which : 'karma_disabled';

$request = $smcFunc['db_query']('', '
SELECT subject
FROM {db_prefix}messages
WHERE id_msg = {int:id_message}
LIMIT 1',
array(
'id_message' => $message_id,
)
);

list ($title) = $smcFunc['db_fetch_row']($request);

$smcFunc['db_free_result']($request);

// Log this new action!
$smcFunc['db_insert']('replace',
'{db_prefix}log_karma',
array('action' => 'int', 'id_target' => 'int', 'id_executor' => 'int', 'log_time' => 'int', 'comment' => 'string', 'action_type' => 'string', 'message' => 'int', 'topic' => 'int', 'title' => 'string'),
array($power, $uid, $user_info['id'], time(), $comment, $action_type, $message_id, $topic_id, $title),
array('id_target', 'id_executor')
);

// Figure out where to go back to.... the topic?
if (isset($_POST['topic']))
redirectexit('topic=' . $_POST['topic'] . '#msg' . $_POST['m']);
// Hrm... maybe a personal message?
elseif (isset($_POST['f']))
redirectexit('action=pm;f=' . $_POST['f'] . ';start=' . $_POST['start'] . (isset($_POST['l']) ? ';l=' . $_POST['l'] : '') . (isset($_POST['pm']) ? '#' . $_POST['pm'] : ''));
// JavaScript as a last resort.
else
{
echo '
<html>
<head>
<title>...</title>
<script language="JavaScript" type="text/javascript"><!-- // -->
history.go(-1);
</script>
</head>
<body>&laquo;</body>
</html>';

obExit(false);
}
}

// For those poor souls without javascript support :(
function SendKarma()
{
global $modSettings, $user_info, $context, $smcFunc, $txt;

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

if(!isset($_GET['uid']) && !isset($_GET['m']) && !isset($_GET['topic']))
return ReputationLog();

// If you're a guest or can't do this, blow you off...
is_not_guest();
isAllowedTo('karma_edit');
checkSession('request');

// These _must_ be a number, no matter what.
$uid = (int) $_GET['uid'];
$message = (int) $_GET['m'];
$topic = (int) $_GET['topic'];

// You can't modify your own, punk! (use the profile if you need to.)
if (empty($uid) || $uid == $user_info['id'])
fatal_lang_error('cant_change_own_karma', false);

// If you don't have enough posts, tough luck.
// !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
if ($user_info['posts'] < $modSettings['karmaMinPosts'])
fatal_lang_error('not_enough_posts_karma', true, array($modSettings['karmaMinPosts']));

$message_request = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}messages
WHERE id_msg = {int:message}
LIMIT 1',
array(
'message' => $message,
)
);

while($row = $smcFunc['db_fetch_assoc']($message_request))
{
$context['message'] = $row;

$board_request = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}boards
WHERE id_board = {int:board}',
array(
'board' => $context['message']['id_board']
)
);

$board = $smcFunc['db_fetch_assoc']($board_request);

// Load the membergroups allowed, and check permissions.
$board_groups = $board['member_groups'] == '' ? array() : explode(',', $board['member_groups']);
$smcFunc['db_free_result']($board_request);

// Kick 'em out if they don't have permission to view this topic!
if (count(array_intersect($user_info['groups'], $board_groups)) == 0 && !$user_info['is_admin'])
fatal_lang_error('topic_gone', false);

// Put it in quote tags to make it stand out a little... and because it's a quote.
$context['message']['body'] = "[quote author={$context['message']['poster_name']} link=topic={$context['message']['id_topic']}.msg{$context['message']['id_msg']}#msg{$context['message']['id_msg']} date={$context['message']['poster_time']}]{$context['message']['body']}[/quote]";

// Amish girls gone wild!
censorText($context['message']['body']);
censorText($context['message']['subject']);

// Run BBC interpreter on the message.
$context['message']['body'] = parse_bbc($context['message']['body'], $context['message']['smileys_enabled'], $context['message']['id_msg']);
}

$context['sub_template'] = 'main';
$context['page_title'] = $txt['karma_add_to'];
$context['topic'] = $topic;
$context['m'] = $message;
$context['uid'] = $uid;
$context['can_pos_rep'] = allowedTo('positive_karma');
$context['can_neg_rep'] = allowedTo('negative_karma');

loadTemplate('Karma');
}

function ReputationLog()
{
global $modSettings, $user_info, $context, $smcFunc, $txt, $scripturl;

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

// If you're a guest or can't do this, blow you off...
is_not_guest();
isAllowedTo('karma_edit');

// Set up the stuff and load the user.
$context['page_title'] = $txt['reputation_log'];
$context['start'] = isset($_GET['start']) ? (int) $_GET['start'] : 0;

$context['rep_sent'] = array();

$request = $smcFunc['db_query']('', '
SELECT COUNT(*) AS count
FROM {db_prefix}log_karma',
array()
);

list ($num_given) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

$request = $smcFunc['db_query']('', '
SELECT k.*, r.real_name AS receiver_name, s.real_name AS sender_name
FROM {db_prefix}log_karma AS k
LEFT JOIN {db_prefix}members AS r ON (r.id_member = k.id_target)
LEFT JOIN {db_prefix}members AS s ON (s.id_member = k.id_executor)
ORDER BY log_time DESC
LIMIT {int:start}, 50',
array(
'start' => $context['start'],
)
);

while ($row = $smcFunc['db_fetch_assoc']($request))
{
parsesmileys($row['comment']);

$context['rep_sent'][] = array(
'action_type' => !empty($row['action_type']) ? $row['action_type'] : ($row['action'] > 0) ? 'karma_good' : 'karma_bad',
'executor' => array(
'name' => $row['sender_name'],
'id' => $row['id_executor'],
),
'target' => array(
'name' => $row['receiver_name'],
'id' => $row['id_target'],
),
'time' => timeformat($row['log_time']),
'comment' => $row['comment'],
'topic_href' => $row['topic'] . '.msg' . $row['message'] . '#msg' . $row['message'],
'topic_title' => $row['title'],
);
}

$smcFunc['db_free_result']($request);

loadTemplate('Karma');
$context['sub_template'] = 'log';

// Construct the page index
$context['page_index'] = constructPageIndex($scripturl . '?action=reputation', $_REQUEST['start'], $num_given, 50);
}

ค้นหา -->>
โค๊ด: [Select]
// Modify a user's karma.
function ModifyKarma()
{

แก้เป็น -->>
โค๊ด: [Select]
/******************* Disabled by Advanced Reputation System **********************
**********************************************************************************
// Modify a user's karma the old and disgusting way...
function ModifyKarma_old()
{

ค้นหา -->>
โค๊ด: [Select]
obExit(false);
}
}

// What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No siree.
function BookOfUnknown()

แก้เป็น -->>
โค๊ด: [Select]
obExit(false);
}
}
**********************************************************************************
******************** Disabled by Advanced Reputation System *********************/

// What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No siree.
function BookOfUnknown()

ลิงค์หัวข้อ: http://dexmore.com/topic/1872
Windows XP    Firefox 3.6.4   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 4 เมื่อ: 24 มิถุนายน 2553, 17:49:13
file $sourcedir/Load.php

ค้นหา -->>
โค๊ด: [Select]
'time_offset' => empty($user_settings['time_offset']) ? 0 : $user_settings['time_offset'],

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'karma_good' => empty($user_settings['karma_good']) ? 0 : $user_settings['karma_good'],
'karma_bad' => empty($user_settings['karma_bad']) ? 0 : $user_settings['karma_bad'],]

ค้นหา -->>
โค๊ด: [Select]
mem.karma_good, mem.id_post_group, mem.karma_bad, mem.lngfile, mem.id_group, mem.time_offset, mem.show_online,

แก้เป็น -->>
โค๊ด: [Select]
mem.karma_good, mem.id_post_group, mem.karma_bad, mem.lngfile, mem.id_group, mem.time_offset, mem.show_online, mem.karma_disabled,

ค้นหา -->>
โค๊ด: [Select]
mem.openid_uri, mem.birthdate, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login, mem.karma_good,

แก้เป็น -->>
โค๊ด: [Select]
mem.birthdate, mem.icq, mem.aim, mem.yim, mem.msn, mem.posts, mem.last_login, mem.karma_good, mem.karma_disabled,

ค้นหา -->>
โค๊ด: [Select]
$buddy_list = !empty($profile['buddy_list']) ? explode(',', $profile['buddy_list']) : array();]

เพิ่มไว้หลัง -->>
โค๊ด: [Select]

$profile['karma_bars'] = array();

// If they are in the positives, and want it displayed
if(!$profile['karma_disabled'] && ($profile['karma_good'] >= $profile['karma_bad']))
{
$points = $profile['karma_good'] - $profile['karma_bad'];
$power = ($points - ($points % $modSettings['karmaBarPower'])) / $modSettings['karmaBarPower'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars == 0 ? 1 : $bars;
$bars = ($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars;
$descriptions = preg_split("/(\r)?\n/", $modSettings['karmaDescriptions']);
$description = $descriptions[$bars - 1];

for($i = 0; $i < $bars; $i++)
$profile['karma_bars'][] = array(
'type' => 'good_basic',
'desc' => $description
);

if($bars >= $modSettings['karmaSuperBar'])
for($i = ($modSettings['karmaSuperBar'] - 1); $i < $bars; $i++)
$profile['karma_bars'][$i]['type'] = 'good_super';

// If they are in the negatives and want it displayed (or don't have a choice)
}
else if(!$profile['karma_disabled'])
{
$points = $profile['karma_bad'] - $profile['karma_good'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars == 0 ? 1 : $bars;
$bars = ($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars;

for($i = 0; $i < $bars; $i++)
$profile['karma_bars'][] = array(
'type' => 'bad_basic',
'desc' => $modSettings['karmaNegativeDescription']
);

$power = 0;

if($bars >= $modSettings['karmaSuperBar'])
for($i = ($modSettings['karmaSuperBar'] - 1); $i < $bars; $i++)
$profile['karma_bars'][$i]['type'] = 'bad_super';
// They don't want it displayed!
}
else
{

$profile['karma_bars'][] = array(
'type' => 'disabled_basic',
'desc' => $modSettings['karmaDisabledDescription']
);

$power = 0;

}

ค้นหา -->>
โค๊ด: [Select]
'good' => $profile['karma_good'],
'bad' => $profile['karma_bad'],

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
'total' => $profile['karma_good'] - $profile['karma_bad'],
'disabled' => $profile['karma_disabled'],
'bars' => $profile['karma_bars'],
'power' => $power,

file $sourcedir/ManageMaintenance.php

ค้นหา -->>
โค๊ด: [Select]
// Clear out the karma actions.
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_karma');

แก้เป็น -->>
โค๊ด: [Select]
// Advanced Reputation System - Never clear out karma logs!
/*
// Clear out the karma actions.
$smcFunc['db_query']('', '
DELETE FROM {db_prefix}log_karma');
*/

file $sourcedir/ManagePermissions.php

โค๊ด: [Select]
'view_mlist',
'karma_edit',

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Advanced Reputation System Settings
'disable_karma_display',
'positive_karma',
'negative_karma',
'delete_karma',

ค้นหา -->>
โค๊ด: [Select]
'karma_edit' => array(false, 'general', 'moderate_general'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Advanced Reputation System Settings
'disable_karma_display' => array(false, 'general', 'moderate_general'),
'positive_karma' => array(false, 'general', 'moderate_general'),
'negative_karma' => array(false, 'general', 'moderate_general'),
'delete_karma' => array(false, 'general', 'moderate_general'),

ค้นหา -->>
โค๊ด: [Select]
$context['non_guest_permissions'] = array(

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
// Advanced Reputation System Settings
'disable_karma_display',
'positive_karma',
'negative_karma',
'delete_karma',

file $sourcedir/ManageServer.php

ค้นหา -->>
โค๊ด: [Select]
$inlinePermissions = array();
foreach ($config_vars as $var)

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
if(isset($_POST['karmaDescriptions'])){
// Let's set two other ones, too!
$config_vars[] = array('int', 'karmaMaxBars');
$config_vars[] = array('int', 'karmaSuperBar');

$_POST['karmaDescriptions'] = trim($_POST['karmaDescriptions']);
$descriptions = count(preg_split("/(\r)?\n/", $_POST['karmaDescriptions']));

$_POST['karmaMaxBars'] = $descriptions;
$_POST['karmaSuperBar'] = ($descriptions - ($descriptions % 2))/2 + 1;
}

file $sourcedir/ManageSettings.php

ค้นหา -->>
โค๊ด: [Select]
'karmaMode' => 2,

แก้เป็น -->>
โค๊ด: [Select]
'karmaMode' => 1,

ค้นหา -->>
โค๊ด: [Select]
array('text', 'karmaSmiteLabel'),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'',
// Advanced Reputation System Settings
array('int', 'karmaValuePost'),
array('int', 'karmaValueThread'),
array('int', 'karmaBarPower'),
array('int', 'karmaBarPoints'),
array('int', 'karmaRegistration'),
array('int', 'karmaBirthday'),
array('text', 'karmaMaxPerDay'),
array('text', 'karmaSpreadAround'),
array('large_text', 'karmaDescriptions'),
array('text', 'karmaDisabledDescription'),
array('text', 'karmaNegativeDescription'),

ค้นหา -->>
โค๊ด: [Select]
'karma' => array(
),
'sig' => array(

แก้เป็น -->>
โค๊ด: [Select]
'karma' => array(
'description' => $txt['karma_settings_desc'],
),
'sig' => array(

file $sourcedir/Post.php

ค้นหา -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];
}
// Posting a new topic.

แก้เป็น -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];

if(!$user_info['is_guest'] && $modSettings['karmaValuePost'] > 0)
$request = $smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET karma_good = karma_good + {int:newkarma}
WHERE id_member = {int:member}',
array(
'newkarma' => $modSettings['karmaValuePost'],
'member' => $user_info['id']
)
);
}
// Posting a new topic.

ค้นหา -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];
}
// Modifying an existing message?

แก้เป็น -->>
โค๊ด: [Select]
$posterIsGuest = $user_info['is_guest'];

if(!$user_info['is_guest'] && $modSettings['karmaValueThread'] > 0)
$request = $smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET karma_good = karma_good + {int:newkarma}
WHERE id_member = {int:member}',
array(
'newkarma' => $modSettings['karmaValueThread'],
'member' => $user_info['id']
)
);
}
// Modifying an existing message?

file $sourcedir/Profile.php

ค้นหา -->>
โค๊ด: [Select]
'permissions' => array(
'label' => $txt['showPermissions'],
'file' => 'Profile-View.php',
'function' => 'showPermissions',
'permission' => array(
'own' => 'manage_permissions',
'any' => 'manage_permissions',
),
),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'reputation' => array(
'label' => $txt['reputation'],
'file' => 'Profile-View.php',
'function' => 'reputation',
'permission' => array(
'own' => array('profile_view_own'),
'any' => array('moderate_forum'),
),
'enabled' => (empty($modSettings['karmaMode']) ? false : true),
),

file $sourcedir/Profile-Modify.php

ค้นหา -->>
โค๊ด: [Select]
'enabled' => !empty($modSettings['karmaMode']),
),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'karma_disabled' => array(
'type' => 'check',
'value' => empty($cur_profile['karma_disabled']) ? false : true,
'label' => $txt['user_disable_karma'],
'subtext' => $txt['user_disable_karma_description'],
'permission' => 'disable_karma_display',
'input_validate' => create_function('&$value', '
$value = $value == 1 ? 1 : 0;

return true;
')
),

ค้นหา -->>
โค๊ด: [Select]
'karma_good', 'hr',

แก้เป็น -->>
โค๊ด: [Select]
'karma_good', 'karma_disabled', 'hr',

file $sourcedir/Profile-View.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// View a summary. Includes the deletion of actions.
function reputation($memID)
{
global $context, $memberContext, $txt, $modSettings, $user_info, $user_profile, $sourcedir, $scripturl, $smcFunc;

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

// Attempt to load the member's profile data.
if (!loadMemberContext($memID) || !isset($memberContext[$memID]))
fatal_lang_error('not_a_user', false);

// Set up the stuff and load the user.
$context += array(
'page_title' => $txt['reputation'] . ' - ' . $memberContext[$memID]['name'],
'member' => &$memberContext[$memID],
'can_delete_karma' => allowedTo('karma_delete'),
'start' => isset($_GET['start']) ? (int) $_GET['start'] : 0,
);

$amount = 15;

// Are we deleting karma entries?
if(isset($_POST['deleteBoxes']))
{
is_not_guest();
isAllowedTo('delete_karma');
checkSession('request');

foreach($_POST['deleteBoxes'] as $value)
if(!preg_match('/[0-9]+\|[0-9]+\|[0-9]{10}/', $value))
die('Hacker!!!');
else
$delete[] = explode('|', $value);

foreach($delete as $value)
{
$request = $smcFunc['db_query']('', '
SELECT action, action_type
FROM {db_prefix}log_karma
WHERE id_executor = {int:executor}
AND log_time = {int:time}
LIMIT 1',
array(
'executor' => $value[1],
'time' => $value[2]
)
);

// Reverse prior actions
while($row = $smcFunc['db_fetch_assoc']($request))
{
loadMemberData($value[0]);
loadMemberContext($value[0], false);

if($row['action_type'] == 'karma_good')
updateMemberData($value[0], array('karma_good' => ($memberContext[$value[0]]['karma']['good'] - ((int) $row['action']))));
else if($row['action_type'] == 'karma_bad')
updateMemberData($value[0], array('karma_bad' => ($memberContext[$value[0]]['karma']['bad'] - ((int) $row['action']))));
}

$smcFunc['db_free_result']($request);

$smcFunc['db_query']('', '
DELETE
FROM {db_prefix}log_karma
WHERE id_executor = {int:executor}
AND log_time = {int:time}',
array(
'executor' => $value[1],
'time' => $value[2]
)
);
}
}

// A list of actions they've been a part of
$request = $smcFunc['db_query']('', '
SELECT *
FROM {db_prefix}log_karma
WHERE id_target = {int:target}
OR id_executor = {int:target}
LIMIT {int:start}, {int:amount}',
array(
'target' => $memID,
'start' => $context['start'],
'amount' => $amount,
)
);

while ($row = $smcFunc['db_fetch_assoc']($request))
{
// There are two types of rows - ones you sent, and ones you received.
if($row['id_target'] == $memID)
{
loadMemberData($row['id_executor']);
loadMemberContext($row['id_executor'], false);

parsesmileys($row['comment']);

$context['member']['karma_actions'][] = array(
'action_type' => !empty($row['action_type']) ? $row['action_type'] : (($row['action'] > 0) ? 'karma_good' : 'karma_bad'),
'executor' => $memberContext[$row['id_executor']]['link'],
'target' => $txt['reputation_you'],
'time' => timeformat($row['log_time']),
'comment' => $row['comment'],
'topic_href' => $row['topic'] . '.msg' . $row['message'] . '#msg' . $row['message'],
'topic_title' => $row['title'],
'delete_value' => $row['id_target'] . '|' . $row['id_executor'] . '|' . $row['log_time'],
);
}
else
{
loadMemberData($row['id_target']);
loadMemberContext($row['id_target'], false);

parsesmileys($row['comment']);

$context['member']['karma_actions'][] = array(
'action_type' => !empty($row['action_type']) ? $row['action_type'] : (($row['action'] > 0) ? 'karma_good' : 'karma_bad'),
'executor' => $txt['reputation_you'],
'target' => $memberContext[$row['id_target']]['link'],
'time' => timeformat($row['log_time']),
'comment' => $row['comment'],
'topic_href' => $row['topic'] . '.msg' . $row['message'] . '#msg' . $row['message'],
'topic_title' => $row['title'],
'delete_value' => $row['id_target'] . '|' . $row['id_executor'] . '|' . $row['log_time'],
);
}
}

$smcFunc['db_free_result']($request);

// And let's find out where the most are...
$request = $smcFunc['db_query']('', '
SELECT COUNT(*) AS num_rows
FROM {db_prefix}log_karma
WHERE id_target = {int:id}
OR id_executor = {int:id}',
array(
'id' => $memID
)
);

list ($total_actions) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

// Construct the page index
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;area=reputation;u=' . $memID, $context['start'], $total_actions, $amount);
}

file $sourcedir/RemoveTopic.php

ค้นหา -->>
โค๊ด: [Select]
if (!empty($row['id_member']) && $decreasePostCount && empty($row['count_posts']) && $row['approved'])
updateMemberData($row['id_member'], array('posts' => '-'));

แก้เป็น -->>
โค๊ด: [Select]
if (!empty($row['id_member']) && $decreasePostCount && empty($row['count_posts']) && $row['approved'])
{
updateMemberData($row['id_member'], array('posts' => '-'));

if($modSettings['karmaValuePost'] > 0)
$request = $smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET karma_good = karma_good - {int:newkarma}
WHERE id_member = {int:member}',
array(
'newkarma' => $modSettings['karmaValuePost'],
'member' => $row['id_member']
)
);
}

ค้นหา -->>
โค๊ด: [Select]
while ($rowMembers = $smcFunc['db_fetch_assoc']($requestMembers))
updateMemberData($rowMembers['id_member'], array('posts' => 'posts - ' . $rowMembers['posts']));

แก้เป็น -->>
โค๊ด: [Select]
while ($rowMembers = $smcFunc['db_fetch_assoc']($requestMembers))
{
updateMemberData($rowMembers['id_member'], array('posts' => 'posts - ' . $rowMembers['posts']));

if($modSettings['karmaValueThread'] > 0)
$request = $smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET karma_good = karma_good - {int:newkarma}
WHERE id_member = {int:memberid}',
array(
'newkarma' => $modSettings['karmaValueThread'],
'memberid' => $rowMembers['id_member']
)
);
}

file $sourcedir/ScheduledTasks.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Check once a day for account birthdays, and give them reputation :)
function scheduled_karma_birthdays()
{
global $smcFunc, $modSettings;

// If we aren't going to give anything in the first place, just return true
if(($modSettings['karmaBirthday'] <= 0) || empty($modSettings['karmaMode']))
return true;

// 86400 is a day's worth of seconds, fyi
$today = time();
$todayBegin = $today - ($today % 86400);
$todayEnd = $todayBegin + 86400;

// Were they born today?
$request = $smcFunc['db_query']('', '
SELECT karma_good, id_member
FROM {db_prefix}members
WHERE date_registered >= {string:todayBegin}
AND date_registered < {string:todayEnd}',
array(
'todayBegin' => $todayBegin,
'todayEnd' => $todayEnd
)
);

while ($row = $smcFunc['db_fetch_assoc']($request))
{
$karmaGood = $row['karma_good'] + $modSettings['karmaBirthday'];
updateMemberData($row['id_member'], array('karma_good' => $karmaGood));
}

$smcFunc['db_free_result']($request);

return true;
}

file $sourcedir/Stats.php

ค้นหา -->>
โค๊ด: [Select]
function DisplayStats()
{
global $txt, $scripturl, $modSettings, $user_info, $context, $smcFunc;

แก้เป็น -->>
โค๊ด: [Select]
function DisplayStats()
{
global $txt, $scripturl, $modSettings, $user_info, $context, $smcFunc, $settings;

ค้นหา -->>
โค๊ด: [Select]
// Format the numbers nicely.

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
if(!empty($modSettings['karmaMode']))
{
$descriptions = preg_split("/(\r)?\n/", $modSettings['karmaDescriptions']);

$result = $smcFunc['db_query']('', '
SELECT (karma_good - karma_bad) AS karma, id_member, real_name
FROM {db_prefix}members
WHERE karma_good > karma_bad
ORDER BY karma DESC
LIMIT 10',
array()
);

while($row = $smcFunc['db_fetch_assoc']($result))
{
$rep_bars = '';

$points = $row['karma'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars < 1 ? 1 : (($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars);
$description = $descriptions[$bars - 1];

for($i = 0; $i < $bars; $i++)
$rep_bars .= '<img src="' . $settings['images_url'] . '/karma_good_' . ($i < ($modSettings['karmaSuperBar'] - 1) ? 'basic' : 'super') . '.gif" title="' . $row['real_name'] . ' ' . $description . '" alt="' . $row['real_name'] . ' ' . $description . '" />';

$context['reputation_best'][] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'reputation_bars' => $rep_bars,
'amount' => '+' . $row['karma'],
);
}

$smcFunc['db_free_result']($result);

$result = $smcFunc['db_query']('', '
SELECT (karma_bad - karma_good) AS karma, id_member, real_name
FROM {db_prefix}members
WHERE karma_bad > karma_good
ORDER BY karma DESC
LIMIT 10',
array()
);

while($row = $smcFunc['db_fetch_assoc']($result))
{
$rep_bars = '';

$points = $row['karma'];
$bars = ($points - ($points % $modSettings['karmaBarPoints'])) / $modSettings['karmaBarPoints'];
$bars = $bars < 1 ? 1 : (($bars > $modSettings['karmaMaxBars']) ? $modSettings['karmaMaxBars'] : $bars);

for($i = 0; $i < $bars; $i++)
$rep_bars .= '<img src="' . $settings['images_url'] . '/karma_bad_' . ($i < ($modSettings['karmaSuperBar'] - 1) ? 'basic' : 'super') . '.gif" title="' . $row['real_name'] . ' ' . $modSettings['karmaNegativeDescription'] . '" alt="' . $row['real_name'] . ' ' . $modSettings['karmaNegativeDescription'] . '" />';

$context['reputation_worst'][] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'reputation_bars' => $rep_bars,
'amount' => '-' . $row['karma'],
);
}

$smcFunc['db_free_result']($result);
}

file $sourcedir/Subs-Members.php

ค้นหา -->>
โค๊ด: [Select]
'openid_uri' => (!empty($regOptions['openid']) ? $regOptions['openid'] : ''),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'karma_good' => ($modSettings['karmaRegistration'] > 0) ? $modSettings['karmaRegistration'] : 0,
'karma_bad' => 0,

file $sourcedir/Xml.php

ค้นหา -->>
โค๊ด: [Select]
'messageicons' => array(
'function' => 'ListMessageIcons',
),

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
'reputation' => array(
'function' => 'Reputation',
),

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Pfft, reloading is for old people!
function Reputation()
{
global $context, $modSettings, $txt, $user_info, $smcFunc;

// If the mod is disabled, show an error.
if (empty($modSettings['karmaMode']))
fatal_lang_error('feature_disabled', true);

// If you're a guest or can't do this, blow you off...
is_not_guest();
isAllowedTo('karma_edit');

checkSession('request');

loadLanguage('Errors');

// We're gonna do things in a different order here, to facilitate errors.
$uid = (int) $_POST['uid'];
$message_id = (int) $_POST['m'];
$topic_id = (int) $_POST['topic'];
$points = $user_info['karma_good'] - $user_info['karma_bad'];
$power = ($points - ($points % $modSettings['karmaBarPower'])) / $modSettings['karmaBarPower'];
$power = (int) (($power > 0) ? $power : 0);
$comment = (strlen($_POST['reputation_comment']) > 300) ? substr($_POST['reputation_comment'], 0, 300) : $_POST['reputation_comment'];
$yesterday = time() - 86400;
$longtimeago = time() - (60 * 60 * ($modSettings['karmaWaitTime']));
$hoursAgo = ($modSettings['karmaWaitTime'] < 24) ? $yesterday : $longtimeago;
$context['error_txt'] = '';

// If you don't have enough posts, tough luck.
if ($user_info['posts'] < $modSettings['karmaMinPosts'])
$context['error_txt'] .= "\n" . sprintf($txt['not_enough_posts_karma'], $modSettings['karmaMinPosts']);

// And you can't modify your own, punk! (use the profile if you need to, admins!)
else if (empty($uid) || $uid == $user_info['id'])
$context['error_txt'] .= "\n" . $txt['cant_change_own_karma'];

// I fart in your general direction!
else if (strtolower($comment) == 'your mother was a hamster and your father smelt of elderberries!')
$context['error_txt'] .= "\n...and Saint Attila raised the hand grenade up on high, saying, \"O Lord, bless this Thy hand grenade that with it Thou mayest blow Thine enemies to tiny bits, in Thy mercy.\" And the Lord did grin and the people did feast upon the lambs and sloths and carp and anchovies and orangutans and breakfast cereals, and fruit bats and large chu... *ahem* And the Lord spake, saying, \"First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who being naughty in my sight, shall snuff it.\" Amen.";

// Applauding or smiting? Don't try to do a cheap javascript injection on me...
switch ($_POST['type'])
{
case 'agree':
if(!allowedTo('positive_karma'))
$context['error_txt'] .= "\n" . $txt['karma_cant_agree'];
$karma_which = 'karma_good';
break;
case 'disagree':
if(!allowedTo('negative_karma'))
$context['error_txt'] .= "\n" . $txt['karma_cant_disagree'];
$karma_which = 'karma_bad';
break;
default:
// Should never get here
$context['error_txt'] .= "\n" . $txt['karma_choose_action'];
}

// Going in order of permissions... it only gets added if it passes all of the tests!

// Used up all of their $modSettings['karmaMaxPerDay'] ?
if (!empty($modSettings['karmaMaxPerDay']) && ($modSettings['karmaMaxPerDay'] > 0))
{
// Find out if this user has done this in the past 24 hours.
$request = $smcFunc['db_query']('', '
SELECT log_time
FROM {db_prefix}log_karma
WHERE id_executor = {int:current_member}
AND log_time >= {int:yesterday}
LIMIT 1',
array(
'current_member' => $user_info['id'],
'yesterday' => $hoursAgo,
)
);

if ($smcFunc['db_num_rows']($request) >= $modSettings['karmaMaxPerDay'])
$context['error_txt'] .= "\n" . sprintf($txt['karma_maxed_out'], $modSettings['karmaMaxPerDay']);

$smcFunc['db_free_result']($request);
}

// Haven't waited long enough?
if (!empty($modSettings['karmaWaitTime']) && (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum')) && $modSettings['karmaWaitTime'] > 0)
{
// Find out if this user has done this in the past $longenough.
$request = $smcFunc['db_query']('', '
SELECT log_time
FROM {db_prefix}log_karma
WHERE id_executor = {int:current_member}
AND log_time >= {int:waittime}
LIMIT 1',
array(
'current_member' => $user_info['id'],
'waittime' => $longtimeago,
)
);

if ($smcFunc['db_num_rows']($request) > 0)
{
// Give them approximate minutes until they can, to be nice ;)
list ($log_time) = $smcFunc['db_fetch_row']($request);
$log_time_wait = ($log_time + (60 * 60 * $modSettings['karmaWaitTime'])) - time(); // seconds
$log_time_wait = ($log_time_wait - ($log_time_wait % 60)) / 60; // minutes
$context['error_txt'] .= "\n" . sprintf($txt['karma_please_wait'], $modSettings['karmaWaitTime'], $log_time_wait);
}

$smcFunc['db_free_result']($request);
}

// Need to spread it around a bit? No, not the flu, silly!
if (!empty($modSettings['karmaSpreadAround']) && ($modSettings['karmaSpreadAround'] > 0))
{
// Grab the latest karmaSpreadAround actions - if the target is in there, throw an error!
$request = $smcFunc['db_query']('', '
SELECT id_target
FROM {db_prefix}log_karma
WHERE id_executor = {int:current_member}
ORDER BY log_time DESC
LIMIT {int:spread}',
array(
'current_member' => $user_info['id'],
'spread' => $modSettings['karmaSpreadAround'],
)
);

if ($smcFunc['db_num_rows']($request) > 0)
while($row = $smcFunc['db_fetch_assoc']($request))
if($row['id_target'] == $uid)
$context['error_txt'] .= "\n" . $txt['karma_spread_around'];

$smcFunc['db_free_result']($request);
}

// One last test - have they already sent rep to this particular post?
$request = $smcFunc['db_query']('', '
SELECT log_time
FROM {db_prefix}log_karma
WHERE id_executor = {int:executor}
AND message = {string:message}
LIMIT 1',
array(
'executor' => $user_info['id'],
'message' => $message_id
)
);

if($smcFunc['db_num_rows']($request) != 0)
$context['error_txt'] .= "\n" . $txt['karma_sent_twice'];

$smcFunc['db_free_result']($request);

// Finally! Now do an update if there's no error
if($context['error_txt'] == "")
{
$request = $smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET {raw:which} = {raw:which} + {int:power}
WHERE id_member = {int:uid}',
array(
'power' => $power,
'uid' => $uid,
'which' => $karma_which,
)
);

if(!$request)
$context['error_txt'] .= "\n" . $txt['karma_didnt_update'];

$action_type = ($power != 0) ? $karma_which : 'karma_disabled';

$request = $smcFunc['db_query']('', '
SELECT subject
FROM {db_prefix}messages
WHERE id_msg = {int:id_message}
LIMIT 1',
array(
'id_message' => $message_id,
)
);

list ($title) = $smcFunc['db_fetch_row']($request);

$smcFunc['db_free_result']($request);

// Log this new action!
$smcFunc['db_insert']('replace',
'{db_prefix}log_karma',
array('action' => 'int', 'id_target' => 'int', 'id_executor' => 'int', 'log_time' => 'int', 'comment' => 'string', 'action_type' => 'string', 'message' => 'int', 'topic' => 'int', 'title' => 'string'),
array($power, $uid, $user_info['id'], time(), $comment, $action_type, $message_id, $topic_id, $title),
array('id_target', 'id_executor')
);
}

$context['sub_template'] = 'reputation';
}

ลิงค์หัวข้อ: http://dexmore.com/topic/1872
Windows XP    Firefox 3.6.4   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
*
*


!Personal

Germany   ชาย ผู้เริ่มต้นกระทู้นี้ ออฟไลน์544566157 DexMore DexMore DexMore
เว็บไซต์
icon message
general ความคิดเห็นที่ 5 เมื่อ: 24 มิถุนายน 2553, 17:50:42

file $languagedir/Admin.thai-utf8.php

ค้นหา  -->>
โค๊ด: [Select]
$txt['karma'] = 'Karma';

แก้เป็น -->>
โค๊ด: [Select]
$txt['karma'] = 'Reputation';

file $languagedir/Errors.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$txt['not_enough_posts_karma'] = 'Sorry, you don\'t have enough posts to modify karma - you need at least %1$d.';
$txt['cant_change_own_karma'] = 'Sorry, you are not permitted to modify your own karma.';
$txt['karma_wait_time'] = 'Sorry, you can\'t repeat a karma action without waiting %1$s %2$s.';

แก้เป็น -->>
โค๊ด: [Select]
$txt['not_enough_posts_karma'] = 'Sorry, you don\'t have enough posts to modify reputation - you need at least %1$d.';
$txt['cant_change_own_karma'] = 'Sorry, you are not permitted to modify your own reputation.';
$txt['karma_wait_time'] = 'Sorry, you can\'t repeat a reputation action without waiting %1$s %2$s.';

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Advanced Reputation System
$txt['karma_cant_agree'] = 'You are not allowed to give positive reputation to this user!';
$txt['karma_cant_disagree'] = 'You are not allowed to give negative reputation to this user!';
$txt['karma_choose_action'] = 'Make up your mind! Either agree or disagree, please.';
$txt['karma_maxed_out'] = 'You have used up all %1$d of your allowed reputation actions!';
$txt['karma_please_wait'] = 'You must wait %1$d hours between reputation actions. You have approximately %2$d minutes left to wait.';
$txt['karma_spread_around'] = 'Please spread the love before giving it to this user again.';
$txt['karma_didnt_update'] = 'There was an error with the database. Please try again.';
$txt['karma_didnt_log'] = 'There was an error with the reputation log. Please alert an administrator.';
$txt['karma_sent_twice'] = 'You can\'t send reputation twice in the same post!';

file $languagedir/Help.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$helptxt['karmaMode'] = 'Karma is a feature that shows the popularity of a member. Members, if allowed, can
\'applaud\' or \'smite\' other members, which is how their popularity is calculated. You can change the
number of posts needed to have a &quot;karma&quot;, the time between smites or applauds, and if administrators
have to wait this time as well.<br /><br />Whether or not groups of members can smite others is controlled by
a permission.  If you have trouble getting this feature to work for everyone, double check your permissions.';

แก้เป็น -->>
โค๊ด: [Select]
$helptxt['karmaMode'] = 'Reputation is a feature that shows the popularity of a member. Members, if allowed, can
\'applaud\' or \'smite\' other members, which is how their popularity is calculated. You can change the
number of posts needed to have a &quot;reputation&quot;, the time between smites or applauds, and if administrators
have to wait this time as well.<br /><br />Whether or not groups of members can smite others is controlled by
a permission.  If you have trouble getting this feature to work for everyone, double check your permissions.';

file $languagedir/index.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Advanced Reputation System
$txt['karma_title'] = 'Reputation';
$txt['karma_power'] = 'Reputation Power';
$txt['karma_add_to'] = 'Add to Reputation';
$txt['karma_your_opinion'] = 'What do you think of this post?';
$txt['add_karma'] = 'Add Reputation';
$txt['submit'] = 'Submit';
$txt['comment'] = 'Comment';
$txt['karma_agree'] = 'I agree';
$txt['karma_disagree'] = 'I disagree';

file $languagedir/Install.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$txt['default_karmaLabel'] = 'Karma:';

แก้เป็น -->>
โค๊ด: [Select]
$txt['default_karmaLabel'] = 'Reputation:';

file $languagedir/ManageScheduledTasks.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$txt['scheduled_task_desc_paid_subscriptions'] = 'Sends out any necessary paid subscription reminders and removes expired member subscriptions.';

เพิ่มไว้หลัง -->>
โค๊ด: [Select]
$txt['scheduled_task_karma_birthdays'] = 'Birthday Reputation';
$txt['scheduled_task_desc_karma_birthdays'] = 'Sends reputation on members\' birthdays.';

file $languagedir/ManagePermissions.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$txt['permissionname_karma_edit'] = 'Change other people\'s karma';
$txt['permissionhelp_karma_edit'] = 'Karma is a feature that shows the popularity of a member. In order to use this feature, you need to have it enabled in \'Features and Options\'. This permission will allow a membergroup to cast a vote. This permission has no effect on guests.';

แก้เป็น -->>
โค๊ด: [Select]
$txt['permissionname_karma_edit'] = 'Change other people\'s reputation';
$txt['permissionhelp_karma_edit'] = 'Reputation is a feature that shows the popularity of a member. In order to use this feature, you need to have it enabled in \'Features and Options\'. This permission will allow a membergroup to cast a vote. This permission has no effect on guests.';

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Advanced Reputation System
$txt['permissionname_disable_karma_display'] = 'Disable display of own reputation';
$txt['permissionhelp_disable_karma_display'] = 'When a user chooses to disable his or her own reputation, no reputation info will be show to other users - effectively a \'neutral\' reputation.';
$txt['permissionname_negative_karma'] = 'Can -reputation other users';
$txt['permissionhelp_negative_karma'] = 'Can this user send negative reputation to other users? Sometimes used as an incentive for a paid subscription.';
$txt['permissionname_positive_karma'] = 'Can +reputation other users';
$txt['permissionhelp_positive_karma'] = 'Can this user send positive reputation to other users? Most members should be able to.';
$txt['permissionname_delete_karma'] = 'Delete reputuation actions';
$txt['permissionhelp_delete_karma'] = 'Can this user undo reputation actions through their profile?';

$languagedir/ManageSettings.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$txt['karmaMode'] = 'Karma mode';
$txt['karma_options'] = 'Disable karma|Enable karma total|Enable karma positive/negative';
$txt['karmaMinPosts'] = 'Set the minimum posts needed to modify karma';
$txt['karmaWaitTime'] = 'Set wait time in hours';
$txt['karmaTimeRestrictAdmins'] = 'Restrict administrators to wait time';
$txt['karmaLabel'] = 'Karma label';
$txt['karmaApplaudLabel'] = 'Karma applaud label';
$txt['karmaSmiteLabel'] = 'Karma smite label';

แก้เป็น -->>
โค๊ด: [Select]
$txt['karmaMode'] = 'Reputation mode';
$txt['karma_options'] = 'Disable reputation|Enable reputation';
$txt['karmaMinPosts'] = 'Set the minimum posts needed to modify reputation';
$txt['karmaWaitTime'] = 'Set wait time in hours';
$txt['karmaTimeRestrictAdmins'] = 'Restrict administrators to wait time';
$txt['karmaLabel'] = 'Reputation label (unused)';
$txt['karmaApplaudLabel'] = 'Reputation applaud label (unused)';
$txt['karmaSmiteLabel'] = 'Reputation smite label (unused)';

ค้นหา -->>
โค๊ด: [Select]
$txt['core_settings_item_k'] = 'Karma';
$txt['core_settings_item_k_desc'] = 'Karma is a feature that shows the popularity of a member. Members, if allowed, can \'applaud\' or \'smite\' other members, which is how their popularity is calculated.';

แก้เป็น -->>
โค๊ด: [Select]
$txt['core_settings_item_k'] = 'Reputation';
$txt['core_settings_item_k_desc'] = 'Reputation is a feature that shows the popularity of a member. Members, if allowed, can \'applaud\' or \'smite\' other members, which is how their popularity is calculated.';

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Advanced Reputation System
$txt['karmaBarPower'] = 'Users gain 1 power for every __ points?<br />
<span style="font-size: smaller; padding: 3px;">Default 100</span>';
$txt['karmaBarPoints'] = 'Users gain 1 bar image for every __ points?<br />
<span style="font-size: smaller; padding: 3px;">Default 1000</span>';
$txt['karmaDescriptions'] = 'Reputation descriptions - one per line!<br />
<span style="font-size: smaller; padding: 3px;">These are the text that appears when you hover over a bar image.</span>';
$txt['karmaDisabledDescription'] = 'Description for members who disable their reputation display.';
$txt['karmaNegativeDescription'] = 'Description for members who have negative reputation.';
$txt['karmaValuePost'] = 'How many points per post?';
$txt['karmaValueThread'] = 'How many points per thread?';
$txt['karmaRegistration'] = 'Welcome new members with how many points?';
$txt['karmaBirthday'] = 'Surprise a member with how many points on their birthday?';
$txt['karmaSpreadAround'] = 'How many people does a user have to give reputation to before they can repeat a person?';
$txt['karmaMaxPerDay'] = 'How many times a day can a person give reputation?';

$txt['karma_settings_desc'] = '<b>Reputation Points</b>: The individual points that are received when a user makes a post, creates a thread, or is given reputation by another user.<br />
<br />
<b>Reputation Power</b>: The strength with which a person can give another member reputation. A member with a reputation power of 0 will not affect another user\'s reputation at all.';

file $languagedir/Profile.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
// Advanced Reputation System
$txt['user_disable_karma'] = 'Disable display of own reputation?';
$txt['user_disable_karma_description'] = 'Your reputation will not be shown to other users, but you will still receive/lose points.';
$txt['reputation'] = 'View Reputation';
$txt['karma_latest_title'] = 'Latest Reputation Actions';
$txt['no_reputation_actions'] = 'You haven\'t sent or received any reputation!';

file $languagedir/Reports.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$txt['group_perms_name_karma_edit'] = 'Edit user karma';

แก้เป็น -->>
โค๊ด: [Select]
$txt['group_perms_name_karma_edit'] = 'Edit user reputation';

file $languagedir/Stats.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
$txt['best_karma'] = 'Best Karma';
$txt['worst_karma'] = 'Worst Karma';

แก้เป็น -->>
โค๊ด: [Select]
$txt['best_karma'] = 'Best Reputation';
$txt['worst_karma'] = 'Worst Reputation';

file $languagedir/Modifications.thai-utf8.php

ค้นหา -->>
โค๊ด: [Select]
?>

เพิ่มไว้ก่อน -->>
โค๊ด: [Select]
$txt['no_reputation_log'] = 'There are no entries in the reputation log.';
$txt['reputation_log'] = 'Reputation Log';
$txt['reputation_you'] = 'You';
$txt['reputation_sent'] = 'Your reputation action has been sent';

ดาวน์โหลด: reputation2.rar
ขออภัย! ท่านไม่สามารถเข้าถึงข้อมูลส่วนนี้ได้ กรุณาอ่าน เงื่อนไขการใช้งาน DexMore.Com

แตกไฟล์แล้วอัพโหลดไปไว้ที่
file Karma.template.php" -->> $themedir
file karma.gif" -->> $themedir/images
file karma_bad_basic.gif" -->> $themedir/images
file karma_good_basic.gif" -->> $themedir/images
file karma_bad_super.gif" -->> $themedir/images
file karma_good_super.gif" -->> $themedir/images
file karma_disabled_basic.gif" -->> $themedir/images

ลิงค์หัวข้อ: http://dexmore.com/topic/1872
Windows XP    Firefox 3.6.4   see ip บันทึกการเข้า
ดูรายการสิ่งของสำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  สำหรับติดหมุดกระทู้ของคุณ!  เพิ่มเวลาที่อยู่ในระบบอีก 12 ชั่วโมง  น้องหมี..เอาไว้กอดนอนแทนกิ๊ก  สำหรับบอกรักใครสักคน ก็ส่งไปให้เขาเลย!  
ส่งหัวข้อนี้พิมพ์ หน้า: 1 
กระโดดไป:  

Creative Commons License

SMF Thai Translation Powered by SMF © 2006–2012, Simple Machines LLC

WordPress Google เข้าเยี่ยมชมหน้านี้ล่าสุดเมื่อ : 3 ชั่วโมงที่ผ่านมา

jQuery Plugin Copyright © 2551-2555 Themes Design & Hosting by DexMoreGroup

Sitemap | Thai Simple Machines Forum support SMF Thai

Web Begining | SMF Modifications | SMF Thai Translation Web Begining

Drupal | WordPress | CMS Joomla | jQuery Plugin | Web Graphics CMS Joomla